maui
maui copied to clipboard
MAUI app build is broken with .NET 8.0.403
Description
The build of our MAUI App suddenly broke when the new 8.0.403 SDK rolled out. The build works fine with 8.0.402. The errors seems to be related to the MSAL library when used with .NET MAUI. I suspect the MAUI libraries and the identity libraries have some sort of circular or common reference issue.
Repro steps:
- Create a new MAUI App with the latest Visual Studio 17.11.5
- Add Nuget references to:
- Microsoft.Identity.Client (4.65.0 at the time of this writing)
- Microsoft.Identity.Client.Desktop (4.65.0 at the time of this writing)
- Microsoft.Identity.Client.Extensions.Msal (4.65.0 at the time of this writing)
- Build a Windows version. (no code needs to be changed or written actually, adding the references is enough)
Expected: No errors.
Actual: Lots of duplicated type error messages. Like so:
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1296,125,1296,137): error CS0433: The type 'CoreWebView2' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1297,125,1297,167): error CS0433: The type 'CoreWebView2AcceleratorKeyPressedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1305,125,1305,158): error CS0433: The type 'CoreWebView2CompositionController' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1306,125,1306,160): error CS0433: The type 'CoreWebView2ContentLoadingEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1310,125,1310,147): error CS0433: The type 'CoreWebView2Controller' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1313,125,1313,143): error CS0433: The type 'CoreWebView2Cookie' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1314,125,1314,150): error CS0433: The type 'CoreWebView2CookieManager' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1316,125,1316,162): error CS0433: The type 'CoreWebView2DOMContentLoadedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1317,125,1317,175): error CS0433: The type 'CoreWebView2DevToolsProtocolEventReceivedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1318,125,1318,166): error CS0433: The type 'CoreWebView2DevToolsProtocolEventReceiver' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1321,125,1321,148): error CS0433: The type 'CoreWebView2Environment' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1322,125,1322,155): error CS0433: The type 'CoreWebView2EnvironmentOptions' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1326,125,1326,146): error CS0433: The type 'CoreWebView2FrameInfo' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1327,125,1327,166): error CS0433: The type 'CoreWebView2HttpHeadersCollectionIterator' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1328,125,1328,155): error CS0433: The type 'CoreWebView2HttpRequestHeaders' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1329,125,1329,156): error CS0433: The type 'CoreWebView2HttpResponseHeaders' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1331,125,1331,164): error CS0433: The type 'CoreWebView2MoveFocusRequestedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1332,125,1332,165): error CS0433: The type 'CoreWebView2NavigationCompletedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1333,125,1333,164): error CS0433: The type 'CoreWebView2NavigationStartingEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1334,125,1334,164): error CS0433: The type 'CoreWebView2NewWindowRequestedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1335,125,1335,165): error CS0433: The type 'CoreWebView2PermissionRequestedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1337,125,1337,148): error CS0433: The type 'CoreWebView2PointerInfo' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1340,125,1340,159): error CS0433: The type 'CoreWebView2ProcessFailedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1343,125,1343,165): error CS0433: The type 'CoreWebView2ScriptDialogOpeningEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1345,125,1345,145): error CS0433: The type 'CoreWebView2Settings' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1347,125,1347,159): error CS0433: The type 'CoreWebView2SourceChangedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1348,125,1348,164): error CS0433: The type 'CoreWebView2WebMessageReceivedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1349,125,1349,155): error CS0433: The type 'CoreWebView2WebResourceRequest' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1350,125,1350,166): error CS0433: The type 'CoreWebView2WebResourceRequestedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1351,125,1351,156): error CS0433: The type 'CoreWebView2WebResourceResponse' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1352,125,1352,173): error CS0433: The type 'CoreWebView2WebResourceResponseReceivedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1353,125,1353,160): error CS0433: The type 'CoreWebView2WebResourceResponseView' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
1>D:\Devel\X\MauiApp4\MauiApp4\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1354,125,1354,151): error CS0433: The type 'CoreWebView2WindowFeatures' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'
As the repro steps also show, there is no direct reference to these assemblies in the project.
Also tested
- I tested creating manually an UWP app, which refused to add the .Desktop library.
- I tested creating a WinUI3 app, to which I added all three DLLs and it compiled just fine. We only have problem when doing this in MAUI. I tested both 8.0.82 and 8.0.91 but that did not have an effect on this.
(Just to clear things up, we are not creating a new app, our older app's build pipeline suddenly broke with the .NET version published.)
Workaround:
Use global.json to force 8.0.402 SDK will fix the issue for now.
This works as a temporal fix, but someone who knows more about the internals of these libraries should check what and why is happening.
Steps to Reproduce
- Create a new MAUI App with the latest Visual Studio 17.11.5
- Add Nuget references to:
- Microsoft.Identity.Client (4.65.0 at the time of this writing)
- Microsoft.Identity.Client.Desktop (4.65.0 at the time of this writing)
- Microsoft.Identity.Client.Extensions.Msal (4.65.0 at the time of this writing)
- Build a Windows version. (no code needs to be changed or written actually, adding the references is enough)
Link to public reproduction project repository
No response
Version with bug
8.0.82 SR8.2
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
8.0.82 SR8.2
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
Use global.json to force 8.0.402 SDK will fix the issue for now.
This works as a temporal fix, but someone who knows more about the internals of these libraries should check what and why is happening.
Relevant log output
No response
Have you taken a look at https://github.com/dotnet/maui/issues/25132
Specifically, the section about WebView2 errors.
You should be able to work around this for now with adding the property to your project:
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'"">
<CsWinRTRcwFactoryFallbackGeneratorForceOptOut>true</CsWinRTRcwFactoryFallbackGeneratorForceOptOut>
</PropertyGroup>
As of today, I am getting the following errors, which seem to be related to the VS update to 17.11.5 I did yesterday
1>C:\Users\--\Mobile\xxx\obj\xxx\net8.0-windows10.0.19041.0\win10-x86\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGlobalVtableLookup.g.cs(5,21,5,38): error CS0116: A namespace cannot directly contain members such as fields, methods or statements
1>C:\Users\--\Mobile\xxx\obj\xxx\\net8.0-windows10.0.19041.0\win10-x86\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGlobalVtableLookup.g.cs(5,39,5,60): error CS0116: A namespace cannot directly contain members such as fields, methods or statements
1>C:\Users\--\Mobile\xxx\obj\xxx\\net8.0-windows10.0.19041.0\win10-x86\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGlobalVtableLookup.g.cs(5,16,5,21): error CS1514: { expected
1>C:\Users\--\Mobile\xxx\obj\xxx\\net8.0-windows10.0.19041.0\win10-x86\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGlobalVtableLookup.g.cs(5,38,5,39): error CS1022: Type or namespace definition, or end-of-file expected
1>C:\Users\--\Mobile\xxx\obj\xxx\\net8.0-windows10.0.19041.0\win10-x86\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGlobalVtableLookup.g.cs(6,1,6,2): error CS1022: Type or namespace definition, or end-of-file expected
Did you find some solutions? Same error here
This issue has been verified using Visual Studio 17.11.5 (8.0.91 & 8.0.82 & 8.0.80 ). Can repro on windows platform.
Specifically, the section about WebView2 errors.
You should be able to work around this for now with adding the property to your project:
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'""> <CsWinRTRcwFactoryFallbackGeneratorForceOptOut>true</CsWinRTRcwFactoryFallbackGeneratorForceOptOut> </PropertyGroup>
We implemented this workaround and it seems to work for now.
Duplicate of #25132