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

[BUG] Can't publish .NET Core after updating Elastic.Apm.NetCoreAll to V 1.27.1 #2367

Closed
guisantos opened this issue May 28, 2024 · 4 comments
Labels
bug Something isn't working community

Comments

@guisantos
Copy link

APM Agent version

Elastic.Apm..NetCoreAll v 1.27.1

Environment

.NET Core 6
Windows 11

Application Target Framework(s) (e.g. net462, netcoreapp3.1):
net6.0

Describe the bug

After updating Elastic.Apm..NetCoreAll from Version 1.25.0 to 1.27.1 a dependency to MongoDB.Driver.Core is added and a transitive dependency to MongoDB.Driver.Core called zstdsharp.port.
The error happen when you try to publish the API solution to a folder.

To Reproduce

Steps to reproduce the behavior:

  1. Create a .net 6 solution
  2. Install Elastic.Apm.NetCoreAll V 1.27.1
  3. Create a new publish to a folder using the following configurations:
    image
  4. Publish the solution
  5. See error in the output window

Try to to publish the application and you will receive the following error:

Severity Code Description Project File Line Suppression State
Error System.AggregateException: One or more errors occurred. (Code generation failed for method '[ZstdSharp]ZstdSharp.Unsafe.Methods.ZSTD_cwksp_move(ZSTD_cwksp*,ZSTD_cwksp*)') ObiAPI.Api 0
Error Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. ObiAPI.Api 0
Error Error: One or more errors occurred. (Code generation failed for method '[ZstdSharp]ZstdSharp.Unsafe.Methods.ZSTD_cwksp_move(ZSTD_cwksp*,ZSTD_cwksp*)') ObiAPI.Api 0
Error at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction1 action, ParallelOptions options, Boolean stopOnFirstFailure) ObiAPI.Api 0 Error at System.Threading.Tasks.TaskReplicator.Replica.Execute() ObiAPI.Api 0 Error at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException) ObiAPI.Api 0 Error at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) ObiAPI.Api 0
Error at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) ObiAPI.Api 0 Error at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable1 source, ParallelOptions parallelOptions, Action1 body) ObiAPI.Api 0 Error at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList1 list, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) ObiAPI.Api 0 Error at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable1 source, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) ObiAPI.Api 0 Error at System.Threading.Tasks.Parallel.<>c__DisplayClass33_02.b__0(Int32 i) ObiAPI.Api 0
Error at System.Threading.Tasks.Parallel.<>c__DisplayClass19_01.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) ObiAPI.Api 0 Error at System.Threading.Tasks.Parallel.<>c__DisplayClass19_01.b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) ObiAPI.Api 0
Error at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL) ObiAPI.Api 0
Error at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodWithGCInfo methodCodeNodeNeedingCode, Logger logger) ObiAPI.Api 0
Error at ILCompiler.ReadyToRunCodegenCompilation.ComputeDependencyNodeDependencies(List1 obj) ObiAPI.Api 0 Error at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile) ObiAPI.Api 0 Error at ILCompiler.ReadyToRunCodegenCompilation.<ComputeDependencyNodeDependencies>b__36_0(DependencyNodeCore1 dependency) ObiAPI.Api 0
Error at ILCompiler.Program.RunSingleCompilation(Dictionary2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary2 unrootedInputFilePaths, HashSet1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext) ObiAPI.Api 0 Error at ILCompiler.Program.Run(String[] args) ObiAPI.Api 0 Error at ILCompiler.Program.Main(String[] args) ObiAPI.Api 0 Error at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer2.ComputeMarkedNodes() ObiAPI.Api 0
Error ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[ZstdSharp]ZstdSharp.Unsafe.Methods.ZSTD_cwksp_move(ZSTD_cwksp*,ZSTD_cwksp*)' ObiAPI.Api 0
Error --- End of stack trace from previous location --- ObiAPI.Api 0
Error --- End of stack trace from previous location --- ObiAPI.Api 0
Error --- End of inner exception stack trace --- ObiAPI.Api 0

Expected behavior

DLLs and project dependencies publish to a folder

Actual behavior

Impossible to publish the project

@guisantos guisantos added the bug Something isn't working label May 28, 2024
@stevejgordon
Copy link
Contributor

Hi, @guisantos.

Elastic.Apm.NetCoreAll has always had a dependency on MongoDB.Driver.Core. In v1.25.3, we updated the minimum supported dependency to 2.19.0 (from 2.4.4) due to a CVE.

ReadyToRun publishing fails here because the ZstdSharp library uses code that is not AoT compatible. This is not a bug, simply a limitation of that library.

In your case, you can either publish without ReadyToRun or, if you do not require the MongoDB instrumentation, install the Elastic.Apm package and any instrumentation packages you require and see if that works. Note, though, that we do not test the libraries for AoT and do not support that as some of our code relies on reflection, etc., which is likely to fail AoT compilation.

@guisantos
Copy link
Author

Oh, thanks @stevejgordon I'm was doing some cleanup and updates on references and this concerned me, I will do as you suggested using the Elastc.Apm package and add the instrumentations manually, I don't even need the mongodb stuff

@oleg-st
Copy link

oleg-st commented Jun 4, 2024

The current version of MongoDB.Driver.Core (2.25.0) depends on ZstsSharp (0.7.3) which is AoT compatible

@stevejgordon
Copy link
Contributor

Closing as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community
Projects
None yet
Development

No branches or pull requests

3 participants