dotnet-watch needs to be updated to newer analyzers
See original GitHub issueIt appears the DoNotCallToImmutableCollectionOnAnImmutableCollectionValueAnalyzer
has updated its return type and this is causing an error in the 8.0.0 preview1 source-build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=179384&view=logs&jobId=61a52f3a-cec1-5bff-8c02-d8ba2c8bed99&j=61a52f3a-cec1-5bff-8c02-d8ba2c8bed99&t=53e46d9d-cfbd-5072-889d-e51560a71252
In some cases we just disable analyzers entirely for source-build so if that’s an option in this case we could also do that.
Error:
CSC : error AD0001: Analyzer 'Microsoft.NetCore.Analyzers.ImmutableCollections.DoNotCallToImmutableCollectionOnAnImmutableCollectionValueAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.ArrayTypeSymbol' to type 'Microsoft.CodeAnalysis.INamedTypeSymbol'.'. [/vmr/src/sdk/artifacts/source-build/self/src/src/BuiltInTools/dotnet-watch/dotnet-watch.csproj]
##[error]CSC(0,0): error AD0001: (NETCORE_ENGINEERING_TELEMETRY=Build) Analyzer 'Microsoft.NetCore.Analyzers.ImmutableCollections.DoNotCallToImmutableCollectionOnAnImmutableCollectionValueAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.ArrayTypeSymbol' to type 'Microsoft.CodeAnalysis.INamedTypeSymbol'.'.
CSC : error AD0001: Analyzer 'Microsoft.NetCore.Analyzers.ImmutableCollections.DoNotCallToImmutableCollectionOnAnImmutableCollectionValueAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.ArrayTypeSymbol' to type 'Microsoft.CodeAnalysis.INamedTypeSymbol'.'. [/vmr/src/sdk/artifacts/source-build/self/src/src/BuiltInTools/dotnet-watch/dotnet-watch.csproj]
##[error]CSC(0,0): error AD0001: (NETCORE_ENGINEERING_TELEMETRY=Build) Analyzer 'Microsoft.NetCore.Analyzers.ImmutableCollections.DoNotCallToImmutableCollectionOnAnImmutableCollectionValueAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.ArrayTypeSymbol' to type 'Microsoft.CodeAnalysis.INamedTypeSymbol'.'.
Issue Analytics
- State:
- Created 7 months ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Develop ASP.NET Core apps using a file watcher
This tutorial demonstrates how to install and use the .NET Core CLI's file watcher (dotnet watch) tool in an ASP.NET Core app.
Read more >dotnet watch command - .NET CLI
The dotnet watch command is a file watcher that runs a dotnet command when changes in source code are detected.
Read more >Show error summary when build fails using dotnet run/watch
I've conditionally disabled analyzers in my build when running under dotnet watch . Add the following to Directory.Build.props and run as ...
Read more >dotnet watch only trigges on changes OUTSIDE VisualStudio
it works perfectly fine when i modify the *.razor oder *.cs files with another program (notepad, Visual Studio Code, etc…) Visual Studio ......
Read more >.NET 6 Blazor Hot Reload fails depending on the port ...
NET 6 I created a brand new Blazor project. From a terminal I then launched the application using dotnet watch . However, when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sharwell @mavasani
Opened a PR to disable the analyzers in dotnet-watch for source-build at https://github.com/dotnet/sdk/pull/31076. Once the roslyn-analyzers fix above is taken this won’t be necessary but it also won’t hurt anything to not run this analyzer in source-build.