Skip to content
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

Compiler crashes in EditAndContinueMethodDebugInformation.SerializeStateMachineStates #61913

Closed
lanfeust69 opened this issue Jun 15, 2022 · 4 comments
Labels
Area-Interactive Interactive-EnC Need More Info The issue needs more information to proceed.

Comments

@lanfeust69
Copy link

Version Used:
VS 17.3 preview 2.0

Actually part of the problem : roslyn dlls have version 4.3.0-3.22281.14+b4fa09379c7f002b9a8a7a833c7b7224234a7f7f,
but b4fa09379c7f002b9a8a7a833c7b7224234a7f7f isn't a commit that can be found in github !

Steps to Reproduce:
Build one specific of the 13000 projects of our solution (which I can't share)

Expected Behavior:
Compiles normally

Actual Behavior:
Crashes with this call stack :

Unhandled exception. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'value')
   at System.Reflection.Throw.ValueArgumentOutOfRange()
   at System.Reflection.Metadata.BlobWriterImpl.WriteCompressedInteger(BlobBuilder writer, UInt32 value)
   at System.Reflection.Metadata.BlobBuilder.WriteCompressedInteger(Int32 value)
   at Microsoft.CodeAnalysis.Emit.EditAndContinueMethodDebugInformation.SerializeStateMachineStates(BlobBuilder writer)
   at Microsoft.Cci.MetadataWriter.SerializeEncMethodDebugInformation(IMethodBody methodBody, MethodDefinitionHandle method)
   at Microsoft.Cci.MetadataWriter.SerializeMethodDebugInfo(IMethodBody bodyOpt, Int32 methodRid, Int32 aggregateMethodRid, StandaloneSignatureHandle localSignatureHandleOpt, LocalVariableHandle& lastLocalVariableHandle, LocalConstantHandle& lastLocalConstantHandle)
   at Microsoft.Cci.MetadataWriter.SerializeMethodBodies(BlobBuilder ilBuilder, PdbWriter nativePdbWriterOpt, Blob& mvidStringFixup)
   at Microsoft.Cci.MetadataWriter.BuildMetadataAndIL(PdbWriter nativePdbWriterOpt, BlobBuilder ilBuilder, BlobBuilder mappedFieldDataBuilder, BlobBuilder managedResourceDataBuilder, Blob& mvidFixup, Blob& mvidStringFixup)
   at Microsoft.Cci.PeWriter.WritePeToStream(EmitContext context, CommonMessageProvider messageProvider, Func`1 getPeStream, Func`1 getPortablePdbStreamOpt, PdbWriter nativePdbWriterOpt, String pdbPathOpt, Boolean metadataOnly, Boolean isDeterministic, Boolean emitTestCoverageData, Nullable`1 privateKeyOpt, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Compilation.SerializePeToStream(CommonPEModuleBuilder moduleBeingBuilt, DiagnosticBag metadataDiagnostics, CommonMessageProvider messageProvider, Func`1 getPeStream, Func`1 getMetadataPeStreamOpt, Func`1 getPortablePdbStreamOpt, PdbWriter nativePdbWriterOpt, String pdbPathOpt, RebuildData rebuildData, Boolean metadataOnly, Boolean includePrivateMembers, Boolean isDeterministic, Boolean emitTestCoverageData, Nullable`1 privateKeyOpt, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Compilation.SerializeToPeStream(CommonPEModuleBuilder moduleBeingBuilt, EmitStreamProvider peStreamProvider, EmitStreamProvider metadataPEStreamProvider, EmitStreamProvider pdbStreamProvider, RebuildData rebuildData, Func`2 testSymWriterFactory, DiagnosticBag diagnostics, EmitOptions emitOptions, Nullable`1 privateKeyOpt, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CommonCompiler.CompileAndEmit(TouchedFileLogger touchedFilesLogger, Compilation& compilation, ImmutableArray`1 analyzers, ImmutableArray`1 generators, ImmutableArray`1 additionalTextFiles, AnalyzerConfigSet analyzerConfigSet, ImmutableArray`1 sourceFileAnalyzerConfigOptions, ImmutableArray`1 embeddedTexts, DiagnosticBag diagnostics, CancellationToken cancellationToken, CancellationTokenSource& analyzerCts, Boolean& reportAnalyzer, AnalyzerDriver& analyzerDriver)
   at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.<>c__DisplayClass1_0.<Run>b__0(TextWriter tw)
   at Microsoft.CodeAnalysis.CommandLine.ConsoleUtil.RunWithUtf8Output[T](Func`2 func)
   at Microsoft.CodeAnalysis.CommandLine.ConsoleUtil.RunWithUtf8Output[T](Boolean utf8Output, TextWriter textWriter, Func`2 func)
   at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(String[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
   at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(IEnumerable`1 originalArguments, BuildPaths buildPaths, TextWriter textWriter, String pipeName)
   at Microsoft.CodeAnalysis.CommandLine.BuildClient.Run(IEnumerable`1 arguments, RequestLanguage language, CompileFunc compileFunc, CompileOnServerFunc compileOnServerFunc)
   at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.MainCore(String[] args)
   at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)

Further investigation:
Can't be sure without the proper code available, but I suspect this is due to #61356, and possibly fixed by #61667.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 15, 2022
@tmat
Copy link
Member

tmat commented Jun 15, 2022

@lanfeust69 Is it possible to extract a small repro?

@lanfeust69
Copy link
Author

Hi @tmat

I'm afraid that I would need to invest much more time that what I can afford to even try, and moreover without guarantee of success : that's a single project amidst a very big solution (though "only" 1300 csprojs, not 13000 as I typoed), but it is one of the biggest, which takes more than 30s to compile alone.

Had the code been fully available, I might have tried to hack together a version with the change I mentioned, or at least a debug version where the locals and such would have been readable at the exception location, but as a black-box only investigation, I can't, sorry.

@tmat
Copy link
Member

tmat commented Jun 15, 2022

If you don't mind capturing a memory dump of the crash it would help us determine the problem. You can upload the memory dump via VS Feedback.

@dibarbet dibarbet added Interactive-EnC Need More Info The issue needs more information to proceed. and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 15, 2022
@ghost ghost closed this as completed Aug 25, 2022
@ghost
Copy link

ghost commented Aug 25, 2022

Closing this issue as we've seen no reply to the request for more information. If you are able to get the requested information, please add it to the issue and we will retriage it.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interactive Interactive-EnC Need More Info The issue needs more information to proceed.
Projects
None yet
Development

No branches or pull requests

3 participants