-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Windows Build Errors #25132
Comments
Is this also related to the latest VS update to 17.11.5? Since applying this update this evening, MAUI Windows no longer builds with many (33) errors all along the lines of:
I've added the following
|
@jayhayman-hdd can you open a new issue with more details and a repro? Thanks! |
@jayhayman-hdd in the issue you open, can you also comment on what version of That pre-existing issue is getting exposed by the code generated by |
|
I haven't had a chance to test this today as the team has been wrapping up a prod release for a client tomorrow. If anyone has already opened this as a new issue, I'll happily add my experience to it tomorrow (Thursday), or I'll create a new issue. Just glad I set a policy for me to canary new releases before being applied to the team ;) The project that failed to build (https://apps.microsoft.com/detail/9n5w2tkq5sf0?hl=en-gb&gl=GB / https://play.google.com/store/apps/details?id=com.assettrackerpro.capture&hl=en-GB) has been an early MAUI project from .Net 6 onwards (but I think I re-created the project from a blank MAUI .Net 7 template) that has been upgraded with each minor and major release so possibly it's picked up some cruft. Deploys to Windows 10, Windows 11, iOS and Android. This project is bit of a big one... I have another MAUI project that's a bit smaller (https://www.ben-app.co.uk/) that was created a few months ago so I'll try that on my spare dev box at home tonight. |
I have updated: And it does not compile the |
Raised a new issue here: #25160 |
@bdovaz have you actually installed .NET 9 RC2 release of the SDK and installed the corresponding new workloads? While often the newer 'nuget' than the workload you have installed can be used in projects, it isn't always guaranteed to work that way. In this case I believe you will need the .NET 9 RC2 SDK plus |
@Redth ok, it's just that until now I was only consuming the preview package using the .NET 8 SDK but I see that I'm out of luck and I have to change the SDK. I will wait for the GA release then. Thanks. |
follow this and it throw new error: "Exception has been thrown by the target of an invocation" . i use Telerik trial
|
I have a packaged WinUI 3 project that broke. Adding
got rid of the
My .csproj file has defined TargetFramework as:
|
May be which depend on SkiaSharp like Telerik will cause this. When VS2022 ver 17.11.5 cant build maui i switch to Rider try to build it but it have the same. Roll back to previous version 17.11.4 saved me |
This doesn't resolve the issue. I'm dead in the water again. Also, there's a typo in the suggested workaround. There's an extra " after 'windows'. |
@hunsra Can you post the error you are hitting? Is it the same as the WebView error above? |
Sure. It is not the same, as it doesn't refer to WebView2. In fact, it doesn't refer to any specific assembly. It's similar in that it relates to the WinRT.SourceGenerator on Windows:
The error message repeats 96 times with different values in the parentheses following ".g.cs". I tried the suggestion from @Redth above to add the following to the project file:
However, that didn't resolve the issue. I had to remove the following from the project file as well, as suggested by @espenrl above:
This was previously added by suggestion in the past to resolve a different build issue I had with a prior .NET MAUI release. However, now it will build with it removed. This .NET MAUI release seems to have also introduced other issues such as a new crash in XAML parsing on iOS that wasn't present before, but that's a different page in the saga. |
This worked for me
|
I follow most of the instructions here but it still getting an error message after I attempt to build my MAUI application: Please notice that the generated type is not part of my source code but auto generated 1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(71,25,71,45): error CsWinRT1028: Class 'XamlMetaDataProvider' implements WinRT interfaces but isn't marked partial. Type should be marked partial for trimming and AOT compatibility if passed across the ABI. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md) |
@rodrigovaras Is your project marked as AOT compatible (either with |
There have been some recent changes to .NET SDK for Windows introduce support for different projection profiles to be used as well as new roslyn analyzers introduced to help detect incompatibilities with your code and Native AOT. These changes can cause some issues with existing .NET MAUI projects but are generally easy to work around.
Given the complexity of how some of these pieces fit together there are a number of areas which will ship servicing fixes to address the issues:
There are some related issues for those interested to learn more:
More on AOT / Trimming support in Windows / CsWinRT:
Warnings / Errors and Workarounds
There are a few examples of warnings/errors you may encounter below:
To fix these errors, you can add a property to your .csproj file:
If you see an error similar to the one below, you will need to add a partial identifier to the class mentioned in the error due to a new analyzer detecting code which is not Native AOT compatible:
WebView2 - Type exists in both WebView2.Core and Microsoft.WinUI
If you encounter an error similar to this:
You can set this property in your project for now:
There is already an associated PR with the fix: microsoft/CsWinRT#1816 which will be released in an upcoming servicing release.
The text was updated successfully, but these errors were encountered: