-
Notifications
You must be signed in to change notification settings - Fork 388
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
Fix resolving assemblies from frameworks not referenced by coverlet itself #1449
Conversation
Unfortunately I do not understand why the builds are failing. |
Thanks for the contribution. Could you try to adapt <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>false</IsTestProject>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
</PropertyGroup>
</Project> I think this is some default behavior of ASP.NET 5.0. |
I did, and the build gets successful! |
Can you add a test with WPF like you did for asp.net? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good...maybe add a sample also for WPF framework before to merge for the dogfooding.
I did, but (as expected) the builds fails for Linux and MacOS. |
11d2af9
to
8a4c274
Compare
I started introducing separate solution configurations to build test "Windows Desktop" on "Windows" only. |
@lg2de thanks a lot for this PR. This tackles some issues I had planned to work on in the last months but never found the time to (#1221; #1432; #1231; #1459). I still want to do some manual tests and have some questions. First of all why did you decide to even search in the specific version directory instead of just search all over Another issue I'm facing is that I still get an Sorry I didn't find much more time to analyse the PR yet. 🙏 |
The problem is not WPF anymore. With commit "Introduce separate solution configurations for Windows and non-Windows [ed0e4e9] I already separated WPF test on Windows only. See, macOS builds were recently successful. The current problem is that the build is not reliable. As written on 18 march there are two builds with the same output (warning/error due to missing header) with different outcome. I have no idea what the problem is.
I introduced evaluating the JSON file because it defines, which runtime version should be used.
I'm not sure what do you mean. When debugging you should see wether it get called or not.
I'm a bit confused. What is the status of the project? It is referenced by the official dotnet sdk test project templates. So, I guess it is in the focus of Microsoft. This PR is now 2 month old and fixes problems existing and known for long time. And it is still not completed... |
Just a side note: On my my machine (macOS Ventura) I can build (and publish) a WPF apps when I use This is how my csproj looks like: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWpf>true</UseWpf>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
</Project> |
Hi @lg2de coverlet is not under Microsoft focus in the sense of "ownership", it's been historically the first open source MIT solution to have code-coverage cross platform and added to the template for that reason. As said coverlet is open and maintained by the community(MS devs are contributors too of coverlet), at the moment we're mainly in 3 me(at the moment on deploy to nuget), @daveMueller for the code and @petli helping with code review, plus sometime the original creator @tonerdo . Sorry for the late answers last year it's been hard for me dedicate a lot of time to the project and @daveMueller is doing a tremendous amount of work to keep coverlet in a good shape, for that reason I want to really thank @daveMueller and @petli 🙇 Due to the amount of devs we don't have tight schedule, but if you're interested into join the coverlet dev support let me know and we can have an offline chat for it. Microsoft is shipping a free non open source cross platform solution for code coverage built-in in the sdk together with coverlet. You can try it using the flag |
@bitbonk Thanks I didn't know the When you build with @lg2de @MarcoRossignoli as So I would suggest we skip this wpf project and test for now and create another issue for the missing test that we resolve after the migration to |
Sure nevermind, I was just curious. I was just thinking we could search for
Sorry on that day I just had a couple of minutes to try out your PR and went through some other issues to see if they are also solved by this (must have been one of those #1221, #1432, #1231, #1459). Thus I can't give you any more details yet if there is another constellation that might not work or maybe it was just me that made an error when compiling your branch locally. I plan on doing this more in detail as soon as I find a bit more time in the next days. |
Sure, we can have a discussion on joining, @MarcoRossignoli. I do not know whether I can really help. Here I just followed the error message and identified the mismatch regarding the expectation.
Why two solutions in parallel? What are the advantages of the solutions? (I know this is off-topic...)
This feature may help in compilation. But the WPF test will not be executable on Linux or macOS, isn't it?
The build is already successful on macOS, @MarcoRossignoli, @daveMueller!
There is no relation to the platform!
Sure, the current solution is not fully identical to the search logic in the dotnet runtime. But it is at least close enough and faster than searching for all files and checking the file version. |
@lg2de Really sorry for the late response on this. Meanwhile we migrated
Yes but therefore |
This seams not to work. I guess it is just not possible to load the test assembly. |
Yes you right, sorry for that. I worked a bit on this myself and moved the wpf test to an integration test. In that case the assembly can be loaded only when the test is executed. You can see this here -> #1468 I also could confirm now that your changes also fix #1459. A bit odd is that I had to move the registration of the Nevertheless, would you mind to take over my changes to get rid of the different build configurations? I think we then can finally merge this PR. |
I did. Hope it can be released soon.
At the beginning of this PR I already wrote: "I've changed the order of referenced resolvers in CecilAssemblyResolver because ReferenceAssemblyPathResolver is quite aggressive and throws an exception even the called method TryResolveAssemblyPaths suggests a 'try pattern'." |
@lg2de thanks a lot for this 🙏. @MarcoRossignoli @petli this can be merged now. |
* use System.CommandLine for coverlet.console * resolve review comments and add DotnetTool tests * add space between CLI argument (#1499) matches the same argument further down * Fix resolving assemblies from frameworks not referenced by coverlet itself (#1449) * Make tests run on all platforms (#1492) * Integration test for assembly resolver for mvc.razor (#1502) * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * remove spelling configuration * use System.CommandLine for coverlet.console * resolve review comments and add DotnetTool tests * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * Update src/coverlet.console/Program.cs Co-authored-by: David Müller <muellerdavid4@gmail.com> * remove spelling configuration --------- Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Co-authored-by: Lukas Grützmacher <44983012+lg2de@users.noreply.github.com> Co-authored-by: Cédric Luthi <cedric.luthi@gmail.com> Co-authored-by: David Müller <muellerdavid4@gmail.com>
@MarcoRossignoli , @daveMueller , since 3 months I'm waiting for a release with this fix. |
Instead of fixed referencing aspnetcore directories according current runtime (previously done in
AspNetCoreSharedFrameworkResolver
), the frameworks listed in the generated*.runtimeconfig.json
file should be evaluated (now inNetCoreSharedFrameworkResolver
). Then e.g. also net6 WPF assemblies can be loaded.Therefore the existing test was moved to a new project really references aspnetcore5 project.
I've changed the order of referenced resolvers in
CecilAssemblyResolver
becauseReferenceAssemblyPathResolver
is quite aggressive and throws an exception even the called methodTryResolveAssemblyPaths
suggests a "try pattern".This fixes #1221.
Further I commited (separately) two changes to make the project compilable with newer installed IDEs resp. SDKs. If you agree at all I can also move them to a different PR.