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.

dotnet-watch needs to be updated to newer analyzers

See original GitHub issue

It 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.

@tmat @nagilson

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:open
  • Created 7 months ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tmatcommented, Feb 22, 2023
0reactions
crummelcommented, Mar 8, 2023

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.

Read more comments on GitHub >

github_iconTop 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 >

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