-
Notifications
You must be signed in to change notification settings - Fork 4k
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
CSC : error CS0041: Unexpected error writing debug information -- 'Insufficient memory to continue the execution of the program.' #73447
Comments
This is very likely not a real OOM scenario but likely a fragmentation issue or just bug in the DIA writing layer that the compiler is exposing. To debug though going to need to know more about what compilation is happening under the hood here. @roji is there a way to get a binary log for the build that is happening here or surface the compilation in some way? |
/cc @AndriySvyryd, any idea how to get a binlog for |
@roji @jaredpar OOM happens when compiling the generated code, so logs from @TonyValenti Perhaps you can share the code generated by The current theory is that this is caused by the large number of unqualified lambdas (many of which are transformed into expression trees) in a single method. |
Here you go. |
@TonyValenti can you provide a compiler log of the build? https://github.com/jaredpar/complog?tab=readme-ov-file#creating-compiler-logs The generated code itself isn't going to be enough to track this down. Need to see it in the context of the greater build. Note: that log will include basically all code in your project. So if it's not okay to share publicly please create a VS feedback ticket, share it there and put the link in this issue so I can assign it to my team. |
Here you go! |
@jaredpar - Do you have everything you need? |
@TonyValenti thanks for checking. I can repro this on my machine now with the provided compiler log. |
@TonyValenti seems like my suspicion of this being an issue in DIA may be correct. Switching the compilation to use portable PDBs vs. Native PDBs causes the error to go away. Short term you can flip to using Note: is there a particular reason you're not already using portable PDBs? For .NET Core projects they're generally preferred. |
Hi @jaredpar - |
@TonyValenti the projects all seemingly have this import pattern at the top <Import Project="..\..\UniversalMigrator.Shared\__Shared\Shared.props" /> That Note: I'm not familiar with PostSharp so unsure if this is / isn't related to that. |
The method which is causing the OutOfMemoryException inside DiaSymWriter is really large, it has This is the stack trace of the exception:
Note: I've tried updating the |
The bug here is in the native PDB layer, not the C# compiler. There isn't much we can do about it. If you want to pursue that bug please use VS Feedback to file a bug on the C++ team (they own native PDB layer) The reason I'm asking you to file the bug vs. doing it myself is that it's more likely to be prioritized if a customer files the issue. Further it's possible you'll need to send them non-public info as a part of the investigation and that only works if you oriiginate the bug. If you go this route please post the link to the feedback issue here and I'll make sure it's routed to the correct team. Overall though, my recommendation would be to switch to using portable PDBs. Particularly for modern .NET code: <DebugType>portable</DebugType> |
Version Used:
VS 17.9.6
Steps to Reproduce:
dotnet ef dbcontext optimize --context MigrationDbContext_SqlServer --namespace UniversalMigrator.Storage.Generated.SqlServer --output-dir Context.Generated\SqlServer\
Diagnostic Id:
CS0041
Expected Behavior:
The compiler does not crash.
Actual Behavior:
CSC OOMs.
Other Notes:
My PC is using 39 / 64GB or memory. I have plenty of RAM.
I'm not sure how to create a minimal repro of this.
If there are any logs or such I can provide, let me know how.
Also, I can jump on a Zoom/TEAMS with someone and give them access to my PC.
The text was updated successfully, but these errors were encountered: