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

.NET 5.0 linking error #1625

Closed
cdavernas opened this issue Nov 12, 2020 · 6 comments
Closed

.NET 5.0 linking error #1625

cdavernas opened this issue Nov 12, 2020 · 6 comments

Comments

@cdavernas
Copy link

cdavernas commented Nov 12, 2020

Hello,

I recently updated a solution to the .NET 5.0 framework and attempted to build a Docker image from my startup project.
The publish command is the following:
dotnet publish "MyProject.csproj" --runtime alpine-x64 --self-contained true -p:PublishTrimmed=true -p:PublishSingleFile=true -c Release -o /app/output

In NET CORE 3.1, no problem, the command was being executed as expected. In .NET 5.0, though, I get the following error:

LLink : error IL1005: Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqliteDesignTimeServices.ConfigureDesignTimeServices(IServiceCollection): Error processing method 'Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqliteDesignTimeServices.ConfigureDesignTimeServices(IServiceCollection)' in assembly 'Microsoft.EntityFrameworkCore.Sqlite.Design.dll' [/src/Microservices/ProjectManager/Neuroglia.Souche.ProjectManager.Api/Neuroglia.Souche.ProjectManager.Api.csproj] 5> Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqliteDesignTimeServices.ConfigureDesignTimeServices(IServiceCollection): Error processing method 'Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqliteDesignTimeServices.ConfigureDesignTimeServices(IServiceCollection)' in assembly 'Microsoft.EntityFrameworkCore.Sqlite.Design.dll' 5> ---> System.InvalidOperationException: Operation is not valid due to the current state of the object. 5> at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.GetValueNodeFromGenericArgument(TypeReference genericArgument) 5> at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.ProcessGenericArgumentDataFlow(GenericParameter genericParameter, TypeReference genericArgument, IMemberDefinition source) 5> at Mono.Linker.Steps.MarkStep.MarkGenericArgumentConstructors(IGenericInstance instance, IMemberDefinition sourceLocationMember) 5> at Mono.Linker.Steps.MarkStep.MarkGenericArguments(IGenericInstance instance, IMemberDefinition sourceLocationMember) 5> at Mono.Linker.Steps.MarkStep.GetOriginalMethod(MethodReference method, DependencyInfo reason, IMemberDefinition sourceLocationMember) 5> at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember) 5> at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction, MethodDefinition method, Boolean& requiresReflectionMethodBodyScanner) 5> at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) 5> at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason) 5> at Mono.Linker.Steps.MarkStep.ProcessQueue() 5> --- End of inner exception stack trace --- 5> at Mono.Linker.Steps.MarkStep.ProcessQueue() 5> at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() 5> at Mono.Linker.Steps.MarkStep.Process() 5> at Mono.Linker.Steps.MarkStep.Process(LinkContext context) 5> at Mono.Linker.Pipeline.Process(LinkContext context) 5> at Mono.Linker.Driver.Run(ILogger customLogger)

Anyone has an idea on how why I'm gettings these errors with .NET 5.0? And how I could solve them, without sacrificing trimming?

Thanks in advance!

@marek-safar
Copy link
Contributor

@agocke this looks like 5.0 fix candidate to me

/cc @vitek-karas

@MichalStrehovsky
Copy link
Member

This looks like #1559. That issue is also referenced by a customer that just hit it yesterday.

@agocke
Copy link
Member

agocke commented Nov 12, 2020

Is this addressed by #1566?

Or do we not yet have a fix for #1559?

@cdavernas
Copy link
Author

One of my package was referencing an old .net core 3.1 EF Core package, which it seems was provoking the issue. Sorry to have bothered you guys for nothing :( And many thanks for you quick replies!

@murugaratham
Copy link

murugaratham commented Nov 17, 2020

One of my package was referencing an old .net core 3.1 EF Core package, which it seems was provoking the issue. Sorry to have bothered you guys for nothing :( And many thanks for you quick replies!

I've checked through all my packages and do not have .net core 3.1 ef packages, but i'm running into the same issue, can you shed more light on this?

alright, managed to find my reference, it was due to AspNetCore.Diagnostics.HealthChecks

@marek-safar
Copy link
Contributor

Duplicate of #1559

@marek-safar marek-safar marked this as a duplicate of #1559 Nov 26, 2020
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

5 participants