-
Notifications
You must be signed in to change notification settings - Fork 386
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
Problem with coverage after upgrading to .net5[WindowsDesktop app] #1221
Comments
any help here? its affecting our team performance at SAP |
@daveMueller could you assist here? |
Could you try the solutions described in #1102? For me it feels like the same issue. |
Hi @daveMueller I tried publish but still I attached the logs from our CI bamboo tool please let me know if you have other ideas/suggestions |
@daveMueller did you have the chance to check it? |
Sorry really busy lately. A bit odd is that there are a lot of other exceptions in the log regarding references that can't be resolved. Is this a WPF or WinForms project? Up to now I never worked on a desktop app with .net5. Can you share the property group of the projects .csproj file? I read somewhere that there is a <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>
Sorry for just speculating and not being really helpful. @MarcoRossignoli @petli Do you have any idea? |
Hi @abdelrahman-alfar and thx a lot @daveMueller for the help here,
Have you moved from .NET 4.x or from .NET 3.x?
Looking at log this is the main error, coverlet during static instrumentation is not able to find How do you build the project? In past we had similar issue for asp.net, unfortunately coverlet needs to load some deps during instrumentation(Cecil works in this way) and sometimes framework/msbuild(wpf, asp.net, compilers etc...) change the output layout, sometimes they copy lib on out folder sometimes use the "machine wide" installation. I think that in .NET 5.0 for wpf we have the same scenario and maybe we'll need to add a new extension to our resolver https://github.com/coverlet-coverage/coverlet/blob/master/src/coverlet.core/Instrumentation/CecilAssemblyResolver.cs#L73 -> https://github.com/coverlet-coverage/coverlet/blob/master/src/coverlet.core/Instrumentation/CecilAssemblyResolver.cs#L229 And try to load from local Another good addition to avoid to block users would be add a new option to let user to specify additional probing directory so in case of loading error as a "workaround" the user can specify where to search libs. |
@MarcoRossignoli @daveMueller thanks a lot we fixed the problem by adding a post build event which copy the dll from folder to output folder |
I'll keep this one open, we need to improve here. |
@abdelrahman-alfar Can you tell me from where you copy the files? Could you show me your post-build? I have the same problem.
but when I copy PresentationFramework.dll coverlet print:
And now I don't know what to do about it. (I come here from FortuneN/FineCodeCoverage#188 because I use FineCodeCoverage) |
I charged my brain ;) and I remembered that I just add |
This looks like the same issue : #1231 Copying the dll from the refs folder helped multiple users. See that issue for some scripts |
@304NotModified outcome is the same but in this case is slightly different...here we can fix adding well known folders like We should add the Windows resolver to this list https://github.com/coverlet-coverage/coverlet/blob/master/src/coverlet.core/Instrumentation/CecilAssemblyResolver.cs#L75 |
In PR #1449 I tried to fix the problem close to the idea mentioned by @MarcoRossignoli. |
C:\Users\bamboo.nuget\packages\coverlet.msbuild\3.1.0\build\coverlet.msbuild.targets(39,5): warning : [coverlet] Unable to instrument module: XXX because : AssemblyResolutionException for 'PresentationFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Try to add true to test projects or pass '/p:CopyLocalLockFileAssemblies=true' option to the 'dotnet test' command-line
After upgrading to .net5 we have a problem with coverage for one of our projects, the rest of the projects are correctly detected
I tried both suggestions but nothing happens keep receiving the above error
The text was updated successfully, but these errors were encountered: