GOOGLE ADS

Mittwoch, 13. April 2022

Wie behebe ich diesen MSB6006 csc.exe-Fehler (-2146232797) mit VS2019?

Ich habe gerade meine VS2019 Community Edition auf Version 16.7.2 aktualisiert. Mein Projekt konnte mit diesem Fehler nicht mehr erstellt werden (vielleicht Verknüpfungsschritt?)

> Severity Code Description Project File Line Suppression State
> Error MSB6006 "csc.exe" exited with code
> -2146232797. MyProject.Server C:\Program Files\dotnet\sdk\3.1.401\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.Component.targets 179

Ich weiß wirklich nicht, wie ich herausfinden soll, was los ist. Was kann ich mir als nächstes anschauen? Soll ich diese Frage woanders stellen?

Ich habe dies in meinen Windows-Ereignisprotokollen gefunden. Es scheint ein Callstack zu sein:

> Application: csc.exe Framework Version: v4.0.30319 Description: The
> application requested process termination through
> System.Environment.FailFast(string message). Message:
> System.NullReferenceException: Object reference not set to an instance
> of an object. at
> Microsoft.CodeAnalysis.CodeGen.ILBuilder.BasicBlock.ShortenBranches(Int32&
> delta) at
> Microsoft.CodeAnalysis.CodeGen.ILBuilder.ComputeOffsetsAndAdjustBranches()
> at Microsoft.CodeAnalysis.CodeGen.ILBuilder.RealizeBlocks() at
> Microsoft.CodeAnalysis.CodeGen.ILBuilder.Realize() at
> Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl() at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler.GenerateMethodBody(PEModuleBuilder
> moduleBuilder, MethodSymbol method, Int32 methodOrdinal,
> BoundStatement block, ImmutableArray`1 lambdaDebugInfo,
> ImmutableArray`1 closureDebugInfo, StateMachineTypeSymbol
> stateMachineTypeOpt, VariableSlotAllocator variableSlotAllocatorOpt,
> DiagnosticBag diagnostics, DebugDocumentProvider
> debugDocumentProvider, ImportChain importChainOpt, Boolean
> emittingPdb, Boolean emitTestCoverageData, ImmutableArray`1
> dynamicAnalysisSpans, AsyncForwardEntryPoint entryPointOpt) at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol
> methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers&
> processedInitializers, SynthesizedSubmissionFields
> previousSubmissionFields, TypeCompilationState compilationState) at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol
> containingType) at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass22_0.<CompileNamedTypeAsync>b__0()
> Stack: at System.Environment.FailFast(System.String, System.Exception)
> at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
> at
> Microsoft.CodeAnalysis.FatalError.ReportUnlessCanceled(System.Exception)
> at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler+<>c__DisplayClass22_0.<CompileNamedTypeAsync>b__0()
> at
> Microsoft.CodeAnalysis.CodeGen.ILBuilder+BasicBlock.ShortenBranches(Int32
> ByRef) at
> Microsoft.CodeAnalysis.CodeGen.ILBuilder.ComputeOffsetsAndAdjustBranches()
> at Microsoft.CodeAnalysis.CodeGen.ILBuilder.RealizeBlocks() at
> Microsoft.CodeAnalysis.CodeGen.ILBuilder.Realize() at
> Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.GenerateImpl() at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler.GenerateMethodBody(Microsoft.CodeAnalysis.CSharp.Emit.PEModuleBuilder,
> Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Int32,
> Microsoft.CodeAnalysis.CSharp.BoundStatement,
> System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CodeGen.LambdaDebugInfo>,
> System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CodeGen.ClosureDebugInfo>,
> Microsoft.CodeAnalysis.CSharp.StateMachineTypeSymbol,
> Microsoft.CodeAnalysis.CodeGen.VariableSlotAllocator,
> Microsoft.CodeAnalysis.DiagnosticBag,
> Microsoft.CodeAnalysis.CodeGen.DebugDocumentProvider,
> Microsoft.CodeAnalysis.CSharp.ImportChain, Boolean, Boolean,
> System.Collections.Immutable.ImmutableArray`1<Microsoft.CodeAnalysis.CodeGen.SourceSpan>,
> AsyncForwardEntryPoint) at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol,
> Int32, ProcessedFieldInitializers ByRef,
> Microsoft.CodeAnalysis.CSharp.SynthesizedSubmissionFields,
> Microsoft.CodeAnalysis.CSharp.TypeCompilationState) at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol)
> at
> Microsoft.CodeAnalysis.CSharp.MethodCompiler+<>c__DisplayClass22_0.<CompileNamedTypeAsync>b__0()
> at
> Roslyn.Utilities.UICultureUtilities+<>c__DisplayClass5_0.<WithCurrentUICulture>b__0()
> at System.Threading.Tasks.Task.Execute() at
> System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,
> System.Threading.ContextCallback, System.Object, Boolean) at
> System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,
> System.Threading.ContextCallback, System.Object, Boolean) at
> System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task
> ByRef) at System.Threading.Tasks.Task.ExecuteEntry(Boolean) at
> System.Threading.ThreadPoolWorkQueue.Dispatch()


Lösung des Problems

Meine Frage war, wie man recherchiert. Folgendes habe ich getan, in der Hoffnung, dass es anderen hilft.

  • Beginnen Sie mit dem Löschen von Code aus meinem Projekt, eine Datei nach der anderen, bis ich die problematische Datei gefunden habe.

  • Legen Sie diese Datei zurück und beginnen Sie, Funktionskörper einzeln zu löschen, bis ich denjenigen gefunden habe, der ein Problem darstellte.

  • Kommentieren Sie Teile der problematischen Funktion aus, bis ich den Codeabschnitt gefunden habe, der ein Problem darstellte.

  • Erstellen Sie eine neue Konsolenanwendung und fügen Sie den fehlerhaften Code ein.

  • Melden Sie das Problem wie hier beschrieben an Microsoft: https://docs.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2019

  • Für das, was es wert ist, hier ist das Problem, das ich gemeldet habe:
    https://developercommunity.visualstudio.com/content/problem/1162150/vs2019-cscexe-bug-with-switch-statement.html

    (Wenn Sie auf der Suche nach ähnlichen Problemen zu diesem Stapelüberlauf gekommen sind, besteht die Möglichkeit, dass Sie auf dasselbe gestoßen sind wie ich, aber es scheint, als ob dieser Fehler im Allgemeinen lautet: "Sie haben Code geschrieben, den wir nicht einmal kompilieren konnten."... hoffentlich Die obigen Schritte helfen Ihnen dabei.)

    Keine Kommentare:

    Kommentar veröffentlichen

    Warum werden SCHED_FIFO-Threads derselben physischen CPU zugewiesen, obwohl CPUs im Leerlauf verfügbar sind?

    Lösung des Problems Wenn ich das richtig verstehe, versuchen Sie, SCHED_FIFO mit aktiviertem Hyperthreading ("HT") zu verwenden, ...