roslyn: Build crashes in csc.exe since Visual Studio 15.8.x on multiple machines and build server
Version Used:
Visual Studio 15.8.4 - all .NET framework versions are installed
We have this behavior on all 4 development machines (which have the same setup; with Windows 10; VS 15.8.x) and on two build servers with Windows Server 2016 and VS. For us the issue occurs since Visual Studio 15.8
Steps to Reproduce:
- Create New Project: Console App (.NET Core)
- Build Project/Solution
- Crash in CodeAnalysis (see errors below)
Expected Behavior:
No crashes / No error messages
Actual Behavior:
As Visual Studio output: Unhandled Exception: System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.SeparatedSyntaxList'1' from assembly 'Microsoft.CodeAnalysis, Version=2.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
1>------ Build started: Project: ConsoleApp1, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error :
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : Unhandled Exception: System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.SeparatedSyntaxList`1' from assembly 'Microsoft.CodeAnalysis, Version=2.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.SeparatedSyntaxList`1.System.Collections.Generic.IEnumerable<TNode>.GetEnumerator()
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at System.Collections.Immutable.ImmutableArray`1.Builder.AddRange(IEnumerable`1 items)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.Symbol.GetAttributesToBind(OneOrMany`1 attributeDeclarationSyntaxLists, AttributeLocation symbolPart, DiagnosticBag diagnostics, CSharpCompilation compilation, Func`2 attributeMatchesOpt, Binder rootBinderOpt, ImmutableArray`1& binders)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.Symbol.LoadAndValidateAttributes(OneOrMany`1 attributesSyntaxLists, CustomAttributesBag`1& lazyCustomAttributesBag, AttributeLocation symbolPart, Boolean earlyDecodingOnly, Binder binderOpt, Func`2 attributeMatchesOpt)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol.EnsureAttributesAreBound()
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol.ForceComplete(SourceLocation locationOpt, CancellationToken cancellationToken)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetSourceDeclarationDiagnostics(SyntaxTree syntaxTree, Nullable`1 filterSpanWithinTree, Func`4 locationFilterOpt, CancellationToken cancellationToken)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnostics(CompilationStage stage, Boolean includeEarlierStages, DiagnosticBag diagnostics, CancellationToken cancellationToken)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CommonCompiler.CompileAndEmit(TouchedFileLogger touchedFilesLogger, Compilation& compilation, ImmutableArray`1 analyzers, ImmutableArray`1 additionalTextFiles, ImmutableArray`1 embeddedTexts, DiagnosticBag diagnostics, CancellationToken cancellationToken, CancellationTokenSource& analyzerCts, Boolean& reportAnalyzer, AnalyzerDriver& analyzerDriver)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationToken cancellationToken)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.<>c__DisplayClass1_0.<Run>b__0(TextWriter tw)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CommandLine.ConsoleUtil.RunWithUtf8Output[T](Func`2 func)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(String[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CommandLine.DesktopBuildClient.RunLocalCompilation(String[] arguments, BuildPaths buildPaths, TextWriter textWriter)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(IEnumerable`1 originalArguments, BuildPaths buildPaths, TextWriter textWriter)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CommandLine.DesktopBuildClient.Run(IEnumerable`1 arguments, RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(52,5): error : at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)
1>Done building project "ConsoleApp1.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
As messages in the event viewer:
____________
Application: ServiceHub.RoslynCodeAnalysisService32.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 6F0CB2CA (6F0B0000) with exit code 80131506.
____________
Faulting application name: ServiceHub.RoslynCodeAnalysisService32.exe, version: 1.3.77.18573, time stamp: 0xdc9a59bf
Faulting module name: clr.dll, version: 4.7.3132.0, time stamp: 0x5b554329
Exception code: 0xc0000005
Fault offset: 0x0001b2ca
Faulting process id: 0x1954
Faulting application start time: 0x01d450f8e7465638
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.x86\ServiceHub.RoslynCodeAnalysisService32.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: bb92a4e4-1d70-41fc-a636-2598dce4bcbc
Faulting package full name:
Faulting package-relative application ID:
____________
Application: csc.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeLoadException
at Microsoft.CodeAnalysis.SeparatedSyntaxList`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Collections.Generic.IEnumerable<TNode>.GetEnumerator()
at System.Collections.Immutable.ImmutableArray`1+Builder[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].AddRange(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at Microsoft.CodeAnalysis.CSharp.Symbol.GetAttributesToBind(Roslyn.Utilities.OneOrMany`1<Microsoft.CodeAnalysis.SyntaxList`1<Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax>>, Microsoft.CodeAnalysis.CSharp.Symbols.AttributeLocation, Microsoft.CodeAnalysis.DiagnosticBag, Microsoft.CodeAnalysis.CSharp.CSharpCompilation, System.Func`2<Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax,Boolean>, Microsoft.CodeAnalysis.CSharp.Binder, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CSharp.Binder> ByRef)
at Microsoft.CodeAnalysis.CSharp.Symbol.LoadAndValidateAttributes(Roslyn.Utilities.OneOrMany`1<Microsoft.CodeAnalysis.SyntaxList`1<Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax>>, Microsoft.CodeAnalysis.CustomAttributesBag`1<Microsoft.CodeAnalysis.CSharp.Symbols.CSharpAttributeData> ByRef, Microsoft.CodeAnalysis.CSharp.Symbols.AttributeLocation, Boolean, Microsoft.CodeAnalysis.CSharp.Binder, System.Func`2<Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax,Boolean>)
at Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol.EnsureAttributesAreBound()
at Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol.ForceComplete(Microsoft.CodeAnalysis.SourceLocation, System.Threading.CancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetSourceDeclarationDiagnostics(Microsoft.CodeAnalysis.SyntaxTree, System.Nullable`1<Microsoft.CodeAnalysis.Text.TextSpan>, System.Func`4<System.Collections.Generic.IEnumerable`1<Microsoft.CodeAnalysis.Diagnostic>,Microsoft.CodeAnalysis.SyntaxTree,System.Nullable`1<Microsoft.CodeAnalysis.Text.TextSpan>,System.Collections.Generic.IEnumerable`1<Microsoft.CodeAnalysis.Diagnostic>>, System.Threading.CancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnostics(Microsoft.CodeAnalysis.CompilationStage, Boolean, Microsoft.CodeAnalysis.DiagnosticBag, System.Threading.CancellationToken)
at Microsoft.CodeAnalysis.CommonCompiler.CompileAndEmit(Microsoft.CodeAnalysis.TouchedFileLogger, Microsoft.CodeAnalysis.Compilation ByRef, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer>, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.AdditionalTextFile>, System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.EmbeddedText>, Microsoft.CodeAnalysis.DiagnosticBag, System.Threading.CancellationToken, System.Threading.CancellationTokenSource ByRef, Boolean ByRef, Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver ByRef)
at Microsoft.CodeAnalysis.CommonCompiler.RunCore(System.IO.TextWriter, Microsoft.CodeAnalysis.ErrorLogger, System.Threading.CancellationToken)
at Microsoft.CodeAnalysis.CommonCompiler.Run(System.IO.TextWriter, System.Threading.CancellationToken)
at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc+<>c__DisplayClass1_0.<Run>b__0(System.IO.TextWriter)
at Microsoft.CodeAnalysis.CommandLine.ConsoleUtil.RunWithUtf8Output[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`2<System.IO.TextWriter,Int32>)
at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(System.String[], Microsoft.CodeAnalysis.BuildPaths, System.IO.TextWriter, Microsoft.CodeAnalysis.IAnalyzerAssemblyLoader)
at Microsoft.CodeAnalysis.CommandLine.DesktopBuildClient.RunLocalCompilation(System.String[], Microsoft.CodeAnalysis.BuildPaths, System.IO.TextWriter)
at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(System.Collections.Generic.IEnumerable`1<System.String>, Microsoft.CodeAnalysis.BuildPaths, System.IO.TextWriter)
at Microsoft.CodeAnalysis.CommandLine.DesktopBuildClient.Run(System.Collections.Generic.IEnumerable`1<System.String>, Microsoft.CodeAnalysis.CommandLine.RequestLanguage, Microsoft.CodeAnalysis.CommandLine.CompileFunc, Microsoft.CodeAnalysis.IAnalyzerAssemblyLoader)
at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(System.String[])
____________
Faulting application name: csc.exe, version: 2.9.0.63208, time stamp: 0x970ce7d3
Faulting module name: KERNELBASE.dll, version: 10.0.16299.611, time stamp: 0x2ef5f131
Exception code: 0xe0434352
Fault offset: 0x00000000000450d8
Faulting process id: 0xa54
Faulting application start time: 0x01d450f8f2e6938f
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: ec5a9265-9ed1-4c5a-b982-420f7b352b23
Faulting package full name:
Faulting package-relative application ID:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 20 (10 by maintainers)
Glad that was the issue. Profilers can have tricksy behavior like this.
Thanks for providing the binlog. That was the key to figuring this out!