Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet format no longer works #1547

Closed
damienbod opened this issue Mar 11, 2022 · 5 comments
Closed

dotnet format no longer works #1547

damienbod opened this issue Mar 11, 2022 · 5 comments

Comments

@damienbod
Copy link

I have be using dotnet format and think this is great. After installing .NET SDK 6.0.2 and also .NET 6.0.3 , the tool no longer works. Wondering if this will get fixed, or if this is no longer supported?

>dotnet format
Unhandled exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerFinderHelpers.<>c.<LoadAnalyzersAndFixers>b__0_0(Assembly assembly)
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
   at System.Collections.Immutable.ImmutableArray.ToImmut

Greetings Damien

@Romfos
Copy link

Romfos commented Mar 11, 2022

I have the same problem after update

@ranma42
Copy link

ranma42 commented Mar 12, 2022

Is this on an ASP.Net Core project? In that case, #1519 describes a similar issue.
#1433 (comment) proposes a workaround (using the dotnet-format global tool instead of the one shipped with the SDK) that you might want to try.

@damienbod
Copy link
Author

@ranma42 Thanks for the feedback, tried this and this does not solve the issue. Thanks

project: ASP.NET Core 6.0.3

@damienbod damienbod reopened this Mar 12, 2022
@ddobbinsweb
Copy link

same issue today

The dotnet runtime version is '6.0.3'.
  The dotnet CLI version is '6.0.201'.

dotnet format --verify-no-changes --verbosity diag ./mySolution.sln

@JoeRobich
Copy link
Member

There is a fix coming in the next .NET 6 SDK release. In the meantime you can install dotnet-format as a global tool to work around this issue (See #1519 (comment)). Closing this issue as duplicate of #1519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants