question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crashing under dotnet SDK 7.0.306 in vscode

See original GitHub issue

Getting the below exception when running “dotnet format” with the following installed :

  1. dotnet SDK 7.0.306 (windows x64)
  2. C# v2.0.320
  3. EditorConfig for VS Code v0.16.4

Going back to dotnet SDK 7.0.203 (windows x64), stops this from happenening (sorry, didn’t try the intermediate versions).

Unhandled exception: System.NotSupportedException: Specified method is not supported.
   at Microsoft.CodeAnalysis.CSharp.CodeStyle.CSharpCodeStyleOptions.ParseNamespaceDeclaration(String optionString, CodeStyleOption2`1 default)
   at Microsoft.CodeAnalysis.CSharp.CodeStyle.CSharpCodeStyleOptions.<>c__DisplayClass75_2.<.cctor>b__7(String str)
   at Microsoft.CodeAnalysis.Options.EditorConfigValueSerializer`1.TryParseValue(String value, T& result)
   at Microsoft.CodeAnalysis.Options.EditorConfigValueSerializer`1.Microsoft.CodeAnalysis.Options.IEditorConfigValueSerializer.TryParse(String value, Object& result)
   at Microsoft.CodeAnalysis.Options.DocumentOptionSet.TryGetAnalyzerConfigOption(OptionKey optionKey, Object& value)
   at Microsoft.CodeAnalysis.Options.DocumentOptionSet.GetInternalOptionValue(OptionKey optionKey)
   at Microsoft.CodeAnalysis.Options.OptionSet.Microsoft.CodeAnalysis.Options.IOptionsReader.TryGetOption[T](OptionKey2 optionKey, T& value)
   at Microsoft.CodeAnalysis.Options.Extensions.GetOption[T](IOptionsReader options, Option2`1 option, T defaultValue)
   at Microsoft.CodeAnalysis.CSharp.Formatting.CSharpSyntaxFormattingOptions..ctor(IOptionsReader options, CSharpSyntaxFormattingOptions 
fallbackOptions)
   at Microsoft.CodeAnalysis.CSharp.Formatting.CSharpSyntaxFormatting.GetFormattingOptions(IOptionsReader options, SyntaxFormattingOptions fallbackOptions)
   at Microsoft.CodeAnalysis.Formatting.Formatter.GetFormattingOptionsAsync(Document document, OptionSet optionSet, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Formatting.Formatter.FormatAsync(Document document, IEnumerable`1 spans, OptionSet options, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Formatters.WhitespaceFormatter.GetFormattedDocument(Document document, OptionSet optionSet, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Formatters.WhitespaceFormatter.FormatFileAsync(Document document, SourceText sourceText, OptionSet optionSet, AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken)   
   at Microsoft.CodeAnalysis.Tools.Formatters.DocumentFormatter.GetFormattedSourceTextAsync(Document document, OptionSet optionSet, AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Formatters.DocumentFormatter.<>c__DisplayClass8_1.<<FormatFiles>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.Tools.Formatters.DocumentFormatter.ApplyFileChangesAsync(Solution solution, ImmutableArray`1 formattedDocuments, FormatOptions formatOptions, ILogger logger, List`1 formattedFiles, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Formatters.DocumentFormatter.FormatAsync(Solution solution, ImmutableArray`1 formattableDocuments, FormatOptions formatOptions, ILogger logger, List`1 formattedFiles, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.RunCodeFormattersAsync(Solution solution, ImmutableArray`1 formattableDocuments, FormatOptions formatOptions, ILogger logger, List`1 formattedFiles, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, String binaryLogPath)
   at Microsoft.CodeAnalysis.Tools.FormatCommandCommon.FormatAsync(FormatOptions formatOptions, ILogger`1 logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass21_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__4_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass7_0.<<UseExceptionHandler>b__0>d.MoveNext()

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
flipZombcommented, Aug 4, 2023

@JoeRobich The workaround does the trick!. Thanks so much for your really fast help.

0reactions
JoeRobichcommented, Aug 4, 2023

Opened https://github.com/dotnet/roslyn/issues/69392 against Roslyn. Please use that issue for tracking.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Intellisense broke · Issue #329 · microsoft/vscode- ...
Describe the Issue Intellisense is not picking up anything from Unity variables/methods. It worked prior to installing the new extension.
Read more >
The .NET Core SDK cannot be located. . ...
Just simply close your VS Code app. It seems the error is produced because you are installing .NET Core SDK when your VS...
Read more >
Visual Studio 2022 for Mac v17.6 Release Notes
NET SDKs to 7.0.307 and 6.0.413. Fixed an issue where .NET workload project templates were not available when .NET 7.0.400 SDK was installed....
Read more >
.NET and Visual Studio Code
Use Visual Studio Code with the C# and F# extensions to get a powerful editing ... NET SDK is a software development environment...
Read more >
NETSDK1141: Unable to resolve the .NET SDK version as ...
Learn about .NET SDK error NETSDK1141, which occurs when the SDK version could not be resolved in global.json.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found