-
Notifications
You must be signed in to change notification settings - Fork 779
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
Internal compiler error when creating Portable PDB files for source files with very long lines #3866
Comments
@praeclarum Is it possible to share the source code where you're seeing this? Even if you can't share publicly, we could sign an NDA and take a look through private channels. There are still some issues in Portable PDBs we'll have to iron out after completing the .NET Core/.NET Standard support work we're finishing up now. |
Yeah I should be able to share the code with you. Checking now. |
@cartermp: check out Xamarin F# slack for repro details |
As part of writing A DoS Attack against the C# Compiler I stumbled across another way to repo this, using this code and class Class<A, B, C, D, E, F>
{
class Inner : Class<Inner, Inner, Inner, Inner, Inner, Inner>
{
Inner.Inner.Inner.Inner.Inner.Inner.Inner.Inner.Inner.Inner inner;
}
} Warning, it will take almost 3 minutes to compile it and will use over 2GB of memory, so I'm not sure how useful the repo is!!! But it will eventually fail with this stack trace (not identical to the one above, but ends up in the same place, with the same error message): Unhandled Exception: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value
at System.Reflection.Throw.ValueArgumentOutOfRange()
at System.Reflection.Metadata.BlobWriterImpl.WriteCompressedInteger(BlobWriter& writer, UInt32 value)
at System.Reflection.Metadata.Ecma335.MetadataBuilder.WriteAlignedBlobHeap(BlobBuilder builder)
at System.Reflection.Metadata.Ecma335.MetadataBuilder.WriteHeapsTo(BlobBuilder builder, BlobBuilder stringHeap)
at System.Reflection.Metadata.Ecma335.MetadataRootBuilder.Serialize(BlobBuilder builder, Int32 methodBodyStreamRva, Int32 mappedFieldDataStreamRva)
at System.Reflection.PortableExecutable.ManagedPEBuilder.SerializeTextSection(SectionLocation location)
at System.Reflection.PortableExecutable.ManagedPEBuilder.SerializeSection(String name, SectionLocation location)
at Microsoft.Cci.ExtendedPEBuilder.SerializeSection(String name, SectionLocation location)
at System.Reflection.PortableExecutable.PEBuilder.SerializeSections()
at System.Reflection.PortableExecutable.PEBuilder.Serialize(BlobBuilder builder)
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, 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, Boolean metadataOnly, Boolean includePrivateMembers,Boolean isDeterministic, Boolean emitTestCoverageData, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Compilation.SerializeToPeStream(CommonPEModuleBuilder moduleBeingBuilt, EmitStreamProviderpeStreamProvider, EmitStreamProvider metadataPEStreamProvider, EmitStreamProvider pdbStreamProvider, Func`1 testSymWriterFactory, DiagnosticBag diagnostics, Boolean metadataOnly, Boolean includePrivateMembers, Boolean emitTestCoverageData,String pePdbFilePath, CancellationToken cancellationToken)
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.CSharp.CommandLine.Csc.Run(String[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
at Microsoft.CodeAnalysis.CommandLine.CoreClrBuildClient.RunLocalCompilation(String[] arguments, BuildPaths buildPaths, TextWriter textWriter)
at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(IEnumerable`1 originalArguments, BuildPaths buildPaths, TextWriter textWriter)
at Microsoft.CodeAnalysis.CommandLine.CoreClrBuildClient.Run(IEnumerable`1 arguments, RequestLanguage language, CompileFunc compileFunc)
at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args) |
cc @tmat for FYI |
I've encountered this bug when compiling this file today: https://gitlab.com/13xforever/advent-of-code-2015/blob/master/Day19.fs Minimal repro is just a field with a long string: https://gitlab.com/13xforever/advent-of-code-2015/tree/compiler_crash_repro Looks like it crashes if line exceeds 512 characters |
I continue to run into this bug. Any chance it will be fixed? It even happens when disabling debug output. Only happens with optimizations turned on. |
@praeclarum possibly. Would you happen to know which version of F# and/or the compiler you're using? If you're using the mono F# compiler, which IIRC hasn't been updated since F# 4.5, it will be missing this change that changes how ranges are represented in source files to fix numerous issues that used to exist: #4476 I can't say for sure if this affects that, but it might be worth checking against a .NET Core console app to see if the same thing happens? |
I will take a look. |
Sorry I keep forgetting that the compiler is behind on Xamarin. Part of the problem is the VS4Mac F# project settings don't let you control the debug settings, so you have to hack around the project file to disable PDBs. I keep forgetting that and run into this error. |
Hi there! I see the same error with .NET Core 3.1 on Ubuntu Xenial.
|
@cartermp @KevinRansom Hey! Is there any news? |
I'm going to close this, without a repro there is not much we can do. If anyone knows how to repro this and can provide the repro, I can take a look. Thanks Kevin |
oh wait, I just noticed, strikers like to source for a repro. |
Good grief that really is a long line ... 704330 characters. |
When compiling code with long source lines and generating debug symbols, the F# compiler complains:
From the error log it looks like the PDB writer is failing to write some Int32 or UInt32 values.
This was originally reported here: https://bugzilla.xamarin.com/show_bug.cgi?id=60467
Repro steps
Provide the steps required to reproduce the problem
Create a complex app in F#
Compile it with Portable PDB symbols
Expected behavior
Compilation succeeds.
Actual behavior
Compiler fails with:
Known workarounds
If I disable debugging information, compilation succeeds.
The text was updated successfully, but these errors were encountered: