-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzer threw NullReferenceException #12932
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
Comments
@sunildixit could you include the |
Here's the file. |
Thanks. Could you also link your project file? The assets file suggests some fairly odd dependencies - it's a bit difficult to tell how you got there just inspecting it. |
Here you go. |
Thanks @sunildixit. It's clearly not the same issue as #8686 so this does need further investigation since it's not entirely obvious where the null ref is. If you happen to have a simple app to repro the problem, that'd be great. @JunTaoLuo looking at the project.assets.json, would you know why the app's picking up references to Kestrel 1.0, Hosting 1.0 etc? Shouldn't the shared runtime override the values here? |
I think I found one issue. The MVC analyzer was not installed on the MVCApp. I am not sure how to explain how this error cropped up then. But after I explicitly installed the analyzer on the web projects, then the error went away. |
This happens to me as well. The scenario is that I have a project on core 2.2 and a branch updating to 3.0. When I switch branches this happens. |
@mynkow could you please file a new issue with a minimal repro? Thanks. |
I am using VS 2019 Preview 16.3.0 Preview 1.0
I have two webapps in the solution and for both of them I am always getting the warning described below
Warning AD0001 Analyzer 'Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. ConnectorApp.Web 1 Active Analyzer 'Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzer' threw the following exception:
Exception occurred with following context:
Compilation: ConnectorApp.Web
ISymbol: Create (Method)
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.CodeAnalysisExtensions.IsAssignableFrom(ITypeSymbol source, ITypeSymbol target)
at Microsoft.CodeAnalysis.CodeAnalysisExtensions.d__2.MoveNext()
at Microsoft.CodeAnalysis.CodeAnalysisExtensions.d__4.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source) at Microsoft.AspNetCore.Mvc.Analyzers.TopLevelParameterNameAnalyzer.<>c__DisplayClass3_0.b__0(SymbolAnalysisContext symbolAnalysisContext) at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c.b__43_1(ValueTuple2 data)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action1 analyze, TArg argument, Nullable1 info)
The text was updated successfully, but these errors were encountered: