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

Dependency Issue #4

Open
ADCJustinH opened this issue May 30, 2021 · 6 comments
Open

Dependency Issue #4

ADCJustinH opened this issue May 30, 2021 · 6 comments

Comments

@ADCJustinH
Copy link

ADCJustinH commented May 30, 2021

No dice first time I tried this. Build works fine without this package referenced. .Net Core 3.1 Windows 10

9>Failed checking if assembly is optimized: D:.nuget\packages\amazon.aspnetcore.dataprotection.ssm\2.1.0\lib\netstandard2.0\Amazon.AspNetCore.DataProtection.SSM.dll
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: The "DetectUnoptimizedAssembly" task failed unexpectedly.
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: File name: 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: at UnoptimizedAssemblyDetector.DetectUnoptimizedAssembly.CheckAssemblyIsOptimized(String assemblyPath, String file)
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: at UnoptimizedAssemblyDetector.DetectUnoptimizedAssembly.Execute() in /_/src/UnoptimizedAssemblyDetector/DetectUnoptimizedAssembly.cs:line 81
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

@bruno-garcia
Copy link
Owner

Thanks for raising this @ADCJustinH .

Is it possible to share a repro so I can debug it?

Are you running this within Visual Studio? Does it work through the CLI (like dotnet build -c Release) ?
It's relevant because Visual Studio runs MSBuilds through .NET Framework where dotnet build will run with CoreCLR.

This package is shipped with 2 targets, one for Core and one for Framework. Both of which depend on System.Reflection.Metadata, Version=5.0.0.0 but I suspect this will be a .NET Framework (binding redirect?) issue.

@SimonCropp
Copy link

I suspect the problem is you are in a shared appdomain that you dont own. if any other task loads a diff version of Metadata before you, then it will break. u should probably ilmerge or spawn a new appdomain

@SimonCropp
Copy link

actually you dont bundle System.Reflection.Metadata in the package. so how is it meant to find it?

@bruno-garcia
Copy link
Owner

It's defined as a package reference:

<PackageReference Include="System.Reflection.Metadata" Version="5.0.0" />

Are you saying this isn't being loaded like this and it just works by coincidence? :)

@SimonCropp
Copy link

i didnt think package references worked for msbuild tasks. at least that was my experience when building Fody. that might have changed.

and for me this project never works. for my contributions to sentry i had to comment it out and avoid checking that file in

@bruno-garcia
Copy link
Owner

i didnt think package references worked for msbuild tasks. at least that was my experience when building Fody. that might have changed.

It might then be working by coincidence.

and for me this project never works. for my contributions to sentry i had to comment it out and avoid checking that file in

This is odd. It works for me and other contributors. I've also used in other projects.
By any chance can you share what is the error you get when you try to contribute to Sentry? I'd like to fix this package.

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

No branches or pull requests

3 participants