ArgumentNullException thrown from CommandLineProject.CreateProjectInfo()
Version Used: Latest master Steps to Reproduce: Get a .csproj containing analyzer items that need to be installed via nuget packages. I picked the one in Step 1.
- git clone https://github.com/code-cracker/code-cracker.git Now those packages are not installed yet, go straight to step 2.
- Generate the command line args for CodeCracker.csproj by executing msbuild target "CoreCompile", with property ProvideCommandLineArgs set as true (Roslyn enables this feature starting Dev14 Update 1) The command line args generated contains /analyzer: with a path that does not exist.
- Now try to create a ProjectInfo by calling CommandLineProject.CreateProjectInfo(), passing in the command line args produced in above step
Expected Behavior: Creates the ProjectInfo Actual Behavior: The expected ProjectInfo is not created due to ArgumentNullException thrown: Can't resolve analyzer reference: 'Unresolved: ..........
Compiler?
@huizhonglong can you post the full message and stack trace of the exception?
This appears to be an analyzer issue. CC @srivatsn
System.ArgumentException occurred HResult=-2147024809 Message=Can't resolve analyzer reference: 'Unresolved: E:\Repos\code-cracker\packages\codecracker.CSharp.1.0.0-rc5-1047\analyzers\dotnet\cs\CodeCracker.Common.dll'. Source=Microsoft.CodeAnalysis.Workspaces.Desktop StackTrace: at Microsoft.CodeAnalysis.CommandLineProject.CreateProjectInfo(String projectName, String language, IEnumerable`1 commandLineArgs, String projectDirectory, Workspace workspace)
Microsoft.CodeAnalysis.Workspaces.Desktop.dll!Microsoft.CodeAnalysis.CommandLineProject.CreateProjectInfo(string projectName, string language, System.Collections.Generic.IEnumerable
commandLineArgs, string projectDirectory, Microsoft.CodeAnalysis.Workspace workspace) Line 64 C# Microsoft.VisualStudio.Workspaces.Extensions.dll!Microsoft.VisualStudio.Workspaces.Extensions.CodeUnderstanding.Contexts.ManagedProjectContext.CreateProjectInfo(string workspaceDirectory) Line 113 C# @jaredpar
The issue here is that CommandLineProject.CreateProjectInfo() throws an exception when there's an invalid reference or analyzer that's passed in. Moving to IDE since they already have an internal bug tracking the change needed to fix this issue.
Related internal issue for references is 154302.
closing out due to lack of feedback.