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

too many migrations files give compilation error and even BSOD #33641

Closed
graphicsxp opened this issue Apr 29, 2024 · 9 comments
Closed

too many migrations files give compilation error and even BSOD #33641

graphicsxp opened this issue Apr 29, 2024 · 9 comments

Comments

@graphicsxp
Copy link

I have a solution made of 58 .net 8 projects. They all compile just fine in less than 50 seconds except for the migration project which fails to compile on my desktop computer with the error : MSB6006 "csc.exe" exited with code -1073741819.
After having this error, I clean the solution and rebuild and I get a BSOD with error driver_irql_not_less_or_equal. This behavior is consistent each time I compile the migration project.

This happens only on my desktop and not on any other laptop/desktop computers of my colleagues.

My PC is very new with an intel i9 14th generation and 64gb of ram. I don't think there is any hardware issue - I have run memtest + ssd health check - and it runs demanding programs such as games and photo-editing softwares just fine.

The migration project contains 788 migrations files ! If I squash all the migrations into one single file, it compiles just fine.

So is there a known issue with the number of migrations files in a project that could lead to this failed compilation ?

@graphicsxp
Copy link
Author

graphicsxp commented Apr 29, 2024

I actually found some errors in the event viewer that may help :

Faulting application name: csc.exe, version: 4.900.24.12101, time stamp: 0xdf363ce0 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x0000000000000000 Faulting process ID: 0x0x693C Faulting application start time: 0x0x1DA9A6F7C58A7FE Faulting application path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\csc.exe Faulting module path: unknown

and before that one :

Faulting application name: VBCSCompiler.exe, version: 4.900.24.12101, time stamp: 0x8965d690 Faulting module name: Microsoft.CodeAnalysis.ni.dll, version: 4.900.24.12101, time stamp: 0xf92539f3 Exception code: 0x80131623 Fault offset: 0x0000000001b78a97 Faulting process ID: 0x0x93DC Faulting application start time: 0x0x1DA9A6F39357571 Faulting application path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\VBCSCompiler.exe Faulting module path: C:\Windows\assembly\NativeImages_v4.0.30319_64\Microsoft.Cbf18da00#\433d2d87154f70dcf86f4d52f506115b\Microsoft.CodeAnalysis.ni.dll Report ID: 7107aba0-d904-4d19-9d71-186f4da8b2e8 Faulting package full name: Faulting package-relative application ID:

and then the big one :

Application: VBCSCompiler.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.CSharp.Syntax.InternalSyntax.Lexer.ScanStringLiteral(TokenInfo& info, Boolean inDirective) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Lexer.ScanSyntaxToken(TokenInfo& info) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Lexer.LexSyntaxToken() at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Lexer.Lex(LexerMode mode) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxParser.AddNewToken() at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxParser.FetchCurrentToken() at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseArgumentList(SyntaxToken& openToken, SeparatedSyntaxList1& arguments, SyntaxToken& closeToken, SyntaxKind openKind, SyntaxKind closeKind)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseParenthesizedArgumentList()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParsePostFixExpression(ExpressionSyntax expr)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseSubExpressionCore(Precedence precedence)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseSubExpression(Precedence precedence)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseStatementCoreRest(SyntaxList1 attributes, Boolean isGlobal, ResetPoint& resetPointBeforeStatement) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseStatementCore(SyntaxList1 attributes, Boolean isGlobal)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseStatements(CSharpSyntaxNode& previousNode, SyntaxListBuilder1 statements, Boolean stopOnSwitchSections) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseBlock(SyntaxList1 attributes)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseLambdaBody()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.g__parseLambdaExpressionWorker|379_0(<>c__DisplayClass379_0& )
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseLambdaExpression()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.TryParseLambdaExpression()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseTermWithoutPostfix(Precedence precedence)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseSubExpressionCore(Precedence precedence)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseSubExpression(Precedence precedence)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseArgumentExpression(Boolean isIndexer)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseCommaSeparatedSyntaxList[TNode](SyntaxToken& openToken, SyntaxKind closeTokenKind, Func2 isPossibleElement, Func2 parseElement, SkipBadTokens1 skipBadTokens, Boolean allowTrailingSeparator, Boolean requireOneElement, Boolean allowSemicolonAsSeparator) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseArgumentList(SyntaxToken& openToken, SeparatedSyntaxList1& arguments, SyntaxToken& closeToken, SyntaxKind openKind, SyntaxKind closeKind)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseParenthesizedArgumentList()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParsePostFixExpression(ExpressionSyntax expr)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseSubExpressionCore(Precedence precedence)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseSubExpression(Precedence precedence)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseStatementCoreRest(SyntaxList1 attributes, Boolean isGlobal, ResetPoint& resetPointBeforeStatement) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseStatementCore(SyntaxList1 attributes, Boolean isGlobal)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseStatements(CSharpSyntaxNode& previousNode, SyntaxListBuilder1 statements, Boolean stopOnSwitchSections) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseMethodOrAccessorBodyBlock(SyntaxList1 attributes, Boolean isAccessorBody)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseBlockAndExpressionBodiesWithSemicolon(BlockSyntax& blockBody, ArrowExpressionClauseSyntax& expressionBody, SyntaxToken& semicolon, Boolean parseSemicolonAfterBlock)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseMethodDeclaration(SyntaxList1 attributes, SyntaxListBuilder modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt, SyntaxToken identifier, TypeParameterListSyntax typeParameterList) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseMemberDeclarationCore(SyntaxKind parentKind) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseMemberDeclaration(SyntaxKind parentKind) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseClassOrStructOrInterfaceDeclaration(SyntaxList1 attributes, SyntaxListBuilder modifiers)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseTypeDeclaration(SyntaxList1 attributes, SyntaxListBuilder modifiers) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseMemberDeclarationCore(SyntaxKind parentKind) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseMemberDeclaration(SyntaxKind parentKind) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseNamespaceBody(SyntaxToken& openBraceOrSemicolon, NamespaceBodyBuilder& body, SyntaxListBuilder& initialBadNodes, SyntaxKind parentKind) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseNamespaceDeclarationCore(SyntaxList1 attributeLists, SyntaxListBuilder modifiers)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseNamespaceDeclaration(SyntaxList1 attributeLists, SyntaxListBuilder modifiers) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseNamespaceBody(SyntaxToken& openBraceOrSemicolon, NamespaceBodyBuilder& body, SyntaxListBuilder& initialBadNodes, SyntaxKind parentKind) at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseCompilationUnitCore() at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser.ParseWithStackGuard[TNode](Func2 parseFunc, Func2 createEmptyNodeFunc) at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.ParseText(SourceText text, CSharpParseOptions options, String path, ImmutableDictionary2 diagnosticOptions, Nullable1 isGeneratedCode, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.CSharp.CSharpCompiler.ParseFile(CSharpParseOptions parseOptions, CSharpParseOptions scriptParseOptions, SourceText content, CommandLineSourceFile file) at Microsoft.CodeAnalysis.CSharp.CSharpCompiler.ParseFile(CSharpParseOptions parseOptions, CSharpParseOptions scriptParseOptions, Boolean& addedDiagnostics, CommandLineSourceFile file, DiagnosticBag diagnostics, String& normalizedFilePath) at Microsoft.CodeAnalysis.CSharp.CSharpCompiler.<>c__DisplayClass8_0.<CreateCompilation>b__0(Int32 i) at Roslyn.Utilities.UICultureUtilities.<>c__DisplayClass6_01.b__0(T param)
at Roslyn.Utilities.RoslynParallel.<>c__DisplayClass1_0.g__errorHandlingBody|0(Int32 i)
Stack:
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, Microsoft.CodeAnalysis.ErrorReporting.ErrorSeverity, Boolean)
at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportAndPropagateUnlessCanceled(System.Exception, System.Threading.CancellationToken, Microsoft.CodeAnalysis.ErrorReporting.ErrorSeverity)
at Roslyn.Utilities.RoslynParallel+<>c__DisplayClass1_0.g__errorHandlingBody|0(Int32)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Lexer.ScanStringLiteral(TokenInfo ByRef, Boolean)`

@roji
Copy link
Member

roji commented Apr 29, 2024

What's the size of your migration folders, and of the largest file in there?

@graphicsxp
Copy link
Author

the size of the migration folder is 236 Mb and largest file is about 1 Mb

@roji
Copy link
Member

roji commented Apr 30, 2024

Duplicate of #2174

@roji roji marked this as a duplicate of #2174 Apr 30, 2024
@roji
Copy link
Member

roji commented Apr 30, 2024

@graphicsxp take a look at #2174, which tracks first-class support squashing migrations; we're also thinking about deeper changes that would remove the need to have a full model snapshot for each and every migration.

In any case, 236MB of code are bound to have a negative impact on your compilation time etc. In many cases, this huge size is called by using EF's data seeding feature with large data, which is discouraged (since the data has to be duplicated in each model snapshot, for each migration); I advise taking a look, and if that's your case, planning to remove that.

Otherwise I'm going to go ahead and close this as a duplicate of #2174, but if you feel something special is going on, feel free to post back and we can revisit.

@roji roji closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
@graphicsxp
Copy link
Author

i could not agree more on the fact that the high number of migrations in my project has a negative impact. For instance it takes almost 9 minutes to compile the solution on my laptop, so that's way too long, and we'll need to squash them at some point.

Nevertheless my ticket was not about performance issues, but rather about the fact that i get an an error during compilation + bsod. That's very suspicious and always happen with the migration project only. I pasted the event viewer entries above, did you see them ?

@roji
Copy link
Member

roji commented Apr 30, 2024

@graphicsxp sorry, I missed the compiler errors. First, you didn't mention which SDK version you're actually using - make sure it's the latest 8.0. If you're still seeing those errors there, can you please post an issue on the compiler repo, as this doesn't actually have anything to do with EF? You'll most likely have to provide a runnable repro for this.

@graphicsxp
Copy link
Author

8.0.204 is the version i'm using. ok, i'll see to post on that repo but it is unlikely i can provide a runnable repro given the type of issue.

@roji
Copy link
Member

roji commented Apr 30, 2024

@graphicsxp note that it doesn't actually need to be runnable (my bad), just code that, when compiled, produces these exceptions etc. You can probably provide it offline as it's pretty huge.

I suspect the issue is somehow related to the size of the code, but who knows...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants