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

Webview2 nuget package 1.0.961.33 triggers compiler warnings #1722

Closed
rozeboosje opened this issue Sep 9, 2021 · 44 comments
Closed

Webview2 nuget package 1.0.961.33 triggers compiler warnings #1722

rozeboosje opened this issue Sep 9, 2021 · 44 comments
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@rozeboosje
Copy link

rozeboosje commented Sep 9, 2021

Severity Code Description Project File Line Suppression State
Warning The referenced component 'redacted\packages\Microsoft.Web.WebView2.1.0.961.33\build..\lib\Microsoft.Web.WebView2.Core.winmd' could not be found. redacted
Warning The referenced component 'Microsoft.VCLibs.Desktop' could not be found. redacted

When I look at the references I see the following:
Microsoft.VCLibs.Desktop, Version=14.0
redacted\packages\Microsoft.Web.WebView2.1.0.961.33\build..\lib\Microsoft.Web.WebView2.Core.winmd

I can right-click on the references and remove them and the Solution builds without warnings, but when I close the Solution and open it again the above references reappear and when I try to build the warnings reappear.

AB#35907224

@rozeboosje rozeboosje changed the title Webview2 nuget package 2.0.961.33 triggers compiler warnings Webview2 nuget package 1.0.961.33 triggers compiler warnings Sep 9, 2021
@rozeboosje
Copy link
Author

I can confirm that the warnings go away when I revert back to the nuGet package 1.0.902.49

@rozeboosje
Copy link
Author

In case this is of any relevance.... my Solution is built against .NET Framework 4.8

@champnic champnic added bug Something isn't working tracked We are tracking this work internally. labels Sep 9, 2021
@champnic
Copy link
Member

champnic commented Sep 9, 2021

Thanks for the bug report @rozeboosje - I've added it to our backlog to take a look!

@rozeboosje
Copy link
Author

Thank you @champnic for the prompt response.

@champnic
Copy link
Member

champnic commented Sep 9, 2021

@rozeboosje Can you share how you are building the project?

The path you gave:
\packages\Microsoft.Web.WebView2.1.0.961.33\build..\lib\Microsoft.Web.WebView2.Core.winmd
looks like it's missing a backslash between "build" and "..", but according to the docs the $(MSBuildThisFileDirectory) property should end with a backslash:
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2019#reserved-and-well-known-properties

I wonder if something isn't setting the $(MSBuildThisFileDirectory) the same way...

@champnic
Copy link
Member

champnic commented Sep 9, 2021

Or if you are able to share a project which reproduces the issue that would be ideal.

@rozeboosje
Copy link
Author

Sample.zip

Ok I had to rip the guts out of a Solution with 49 projects in it but this is the issue reduced to its bare essentials.

@rozeboosje
Copy link
Author

IssueWithWebview2

It seems ok when you first update the nuGet package to its latest stable build, but when you save the Solution, close it and open it again you start getting the above warnings.

@champnic
Copy link
Member

Thanks, I really appreciate the sample app!

Some interesting things:

  1. Our common.targets file only references the .winmd file if TargetPlatformIdentifier is "UAP", but I verified in the build that TargetPlatformIdentifier is "Windows".
  2. The file actually does exist... unless VS doesn't know how to handle ".."
  3. When I do a build, you're right that the warnings show up in the list, but the build output doesn't actually show any warnings:
    image
    image
    And the diagnostic build output doesn't have any reference to that winmd file.

@rozeboosje
Copy link
Author

I would hope that VS was a bit more robust when it comes to handling ".."s in file paths but who knows :)

Is it something that can be addressed? I noticed alright that the build output didn't throw any warnings but it still leaves me feeling very uneasy about it.

@govindarun
Copy link

This is happening with me also. Every time I restart VS it warns about C:\LMDev\PracticeManagement\Dev\PracticeManagement\packages\Microsoft.Web.WebView2.1.0.961.33\build..\lib\Microsoft.Web.WebView2.Core.winmd' could not be found.

@jjmew
Copy link

jjmew commented Sep 16, 2021

@rozeboosje what version of Visual Studio are you using? I tried to reproduce it on Visual Studio 2022 Preview 5 and I can't reproduce it.

@rozeboosje
Copy link
Author

Visual Studio 2019 Professional Version 16.11.3

@jjmew
Copy link

jjmew commented Sep 16, 2021

In that case, would you download the preview of VS 2022 and try it? You can download it from https://visualstudio.microsoft.com/vs/preview/

@rozeboosje
Copy link
Author

ok I'm downloading it but please tell me this won't interfere with my current VS....

@jjmew
Copy link

jjmew commented Sep 16, 2021

It will not interfere. It supports side by side installations

@rozeboosje
Copy link
Author

Still the same issue. It's fine when you update the nuGet package and you rebuild the solution, but as soon as you close the solution and reopen it, it raises its head again.

StillTheSame

@jjmew
Copy link

jjmew commented Sep 16, 2021

There is some step that I am missing because I can't reproduce. Could you write down the repro steps? If I am able to reproduce it then I can capture logging that will help us diagnose the problem.

@rozeboosje
Copy link
Author

I'm not sure what to tell you about reproducing it. Have you seen the sample I uploaded - Sample.zip - 6 days ago?

@jjmew
Copy link

jjmew commented Sep 16, 2021

Yes, that is what I have been using to try to reproduce it. Here are the steps I am following:

  1. Open Solution (Sample.sln)
  2. Wait for solution to open ( Observe that there are no errors)
  3. Build Solution
  4. Observe that there are no errors
  5. Open Solution
  6. Wait for solution to open ( Observe that there are no errors)

@jjmew
Copy link

jjmew commented Sep 16, 2021

I am able to reproduce this if I build and then wait for about 3 minutes. The warning shows up about 3 minutes after the build was successful.

@rozeboosje
Copy link
Author

Nice one... thank you

@rozeboosje
Copy link
Author

I have just upgraded to WebView2.1.0.992.28

I am still getting the same warnings

@rozeboosje
Copy link
Author

and I'm getting System.ArgumentExceptions but I'll log them in a different issue. I've reverted back to 1.0.961.33

@mikemeinz
Copy link

I am seeing this same issue with SDK version 1.0.992.28 on multiple programs using the WebView2 SDK.

Two warnings displayed in the Visual Studio Error List

Warning		The referenced component 'C:\Users\mm\.nuget\packages\microsoft.web.webview2\1.0.992.28\build\..\lib\Microsoft.Web.WebView2.Core.winmd' could not be found.				
Warning		The referenced component 'Microsoft.VCLibs.Desktop' could not be found.	

Each time I open the .SLN, two references are added to the project.
References

C:\Users\mm\.nuget\packages\microsoft.web.webview2\1.0.992.28\build\..\lib\Microsoft.Web.WebView2.Core.winmd
Microsoft.VCLibs.Desktop

I remove those references, save the project, close Visual Studio, start Visual Studio 2019 Version 16.11.3 and open the .SLN ---- those two references reappear.

Source of the references
Found in NuGet package file: build/Common.targets
<SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0"/>
<Reference Include="$(MSBuildThisFileDirectory)..\lib\Microsoft.Web.WebView2.Core.winmd">

Versions
Visual Studio 2019 Version 16.11.3
WebView2 SDK Version 1.0.992.28
.NET Framework 4.8 WinForms Target CPU: x64

@qwertydog
Copy link

Can confirm that this is still occurring with SDK 1.0.1020.30, in both Visual Studio 2019 v16.11.6 and Visual Studio 2022 v17.0.0

@mikemeinz
Copy link

I also can confirm that this is still occurring with Webview2 SDK 1.0.1020.30 and Visual Studio 2019 v16.11.6

@billybooth
Copy link

I have been seeing this for a while in Visual Studio 2019 and have been asked about it a couple of times by team members. It's obviously only an annoyance, but it does bother a few of us. Ours is a .NET Framework project as well.

@rozeboosje
Copy link
Author

Yes I was playing around with this for a while and at some point I did a .NET 5 project using a WebView2 and it does not cause this warning, but, please, a lot of us are still stuck on .NET Framework 4.8 and will be for the foreseeable future.

@mikemeinz
Copy link

Same exact problem with SDK version 1.0.1056-prerelease.

@rozeboosje
Copy link
Author

Still happening in 1.0.1054.31

While you're correct to say that the software still builds without errors, getting warnings in the Visual Studio "Error List" does not fill one with confidence. Also, I use the output in the Error List to make sure I haven't caused any potential issues. So getting unnecessary warnings from 3rd party components causes clutter in that list, and this might potentially lead to us overlooking genuine warnings produced by our own code. So please treat this with a little more urgency.

@rozeboosje
Copy link
Author

Ok this is getting really upsetting now. We're still getting these warnings with build 1.0.1072.54

My previous comment still applies. Why is nothing done about this?

@champnic
Copy link
Member

Hey @rozeboosje - sorry for the delay here. I'm following up again with the VS team to see if they can take a look and root-cause this issue. The dev who was helping us recently has transitioned out of VS + holidays + this is a warning that doesn't affect the behavior of the WebView2 control itself = why nothing has been done about this yet. I understand the dev experience is still frustrating here, so I hope to hear back from the VS team soon and will update with any guidance. Thanks!

@rozeboosje
Copy link
Author

thank you @champnic

@champnic
Copy link
Member

@rozeboosje et al - The good news is that VS was able to pinpoint the issue. They aren't going to fix it but they've given us a workaround which I'm checking in shortly :) The bad news is that we've just missed the cutoff for the next prerelease SDK this week, but it should be available in the next one in early Feb. Thanks!

@rozeboosje
Copy link
Author

Out of curiosity can you give us a quick summary of what the problem was? But thanks very much for this. I'll be happy to wait another month

@champnic
Copy link
Member

Sure! Apparently in the CSProj system (which is the default when using .NET Framework) the Condition metadata on file references are ignored when making the list of potential files to include or look at, and so the .winmd and VCLibs are added to the references node. This is to help the Solution explorer and other tools in Visual Studio display potentially needed files without the dev needing to figure out exactly what condition they need to have for the file to show up and edit them. However, later on the Design system kicks in in the background and does look at the Conditions, and this is the mismatch that causes the warning to show up. It also explains why the warning only happens at seemingly random points after a project is opened.

The CSProj system is old and not having many fixes done, so the VS team punted on this issue (also due to the potential for unintended consequences, like files disappearing from projects). But luckily the workaround was pretty easy. We switched from the Condition property to using a <Choose><When> which does get evaluated and correctly excludes the problematic files from the project. :)

@rozeboosje
Copy link
Author

Still happening with 2.0.1108.44, I'm afraid.

@champnic
Copy link
Member

champnic commented Feb 9, 2022

That's expected. Can you try with 1.0.1158-prerelease?

@rozeboosje
Copy link
Author

Yes the issue is gone in 1.0.1158-prerelease ... we don't use prereleases in software that needs to be distributed to clients, but I guess this means the fix will be in the next official release?

@champnic
Copy link
Member

Yes the issue is gone in 1.0.1158-prerelease ... we don't use prereleases in software that needs to be distributed to clients, but I guess this means the fix will be in the next official release?

Yes, this should go out with the next release in early March.

@rozeboosje
Copy link
Author

I have just installed the official release 1.0.1150.38 and I'm delighted to report that the problem has now gone away. Thank you again!

@raisinc
Copy link

raisinc commented May 19, 2022

Today is Thursday 19th May 2022 and this issue is still happening under
Microsoft Visual Studio Community 2019 Version 16.11.15 (VisualStudio.16.Release/16.11.15+32510.428)
using Microsoft .NET Framework Version 4.8.04161 and
Microsoft.Web.WebView2 1.0.1210.39

Will it ever be resolved?

@champnic
Copy link
Member

The original issue was resolved. Are you seeing the exact same symptoms? Can you share a screenshot? Do you still see the issue if you use a newer Visual Studio, or if you use WV2 SDK 1.0.1150.38 (to see if this was a regression)?

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

No branches or pull requests

8 participants