-
Notifications
You must be signed in to change notification settings - Fork 307
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
Exception on startup with version 8.3.0 #923
Comments
This is unfortunate, but I think it's expected so far until the new .NET SDK comes out. The problem is that the MVVM Toolkit is using the new Windows SDK projections, but your app is trying to use the old ones (because you have an old version of the .NET SDK that doesn't know about this new version yet). As a workaround, can you try adding this to your .csproj file: <WindowsSdkPackageVersion>10.0.22621.41</WindowsSdkPackageVersion> Replace <TargetFramework>net8.0-windows10.0.18362.0</TargetFramework>
<WindowsSdkPackageVersion>10.0.18362.41</WindowsSdkPackageVersion> Let me know if this solves the issue for you! 🙂 |
I also encountered this problem. |
@Sergio0694 Thank you for your quick answer, I changed my csproj to what you advised and the issue went away
Thanks a lot ! 😃 |
|
Like I said, you need to use a package version that matches your target framework SDK version. So for instance, if you have: <TargetFramework>net8.0-windows10.0.26100.0</TargetFramework> Then you need: <WindowsSdkPackageVersion>10.0.26100.41</WindowsSdkPackageVersion> Etc., basically just replace the last |
@Sergio0694, my project is a universal dll, so no target framework:
What to add here, on upgrade? Or I need to set it in the caller project? |
After adding WindowsSdkPackageVersion identifier, I get different error
here is our target settings <Platforms>x64</Platforms>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<WindowsSdkPackageVersion>10.0.22621.41</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<EnableWindowsTargeting>true</EnableWindowsTargeting> Project is using WinUI3 |
That is expected if you're using an older version of WinAppSDK. You need to update to 1.6 preview 2, or later. |
@LucaCris you need to add that in the consuming project (presumably, your app) that's targeting Windows 🙂 |
1.6 preview 2?! Ok... nothing for now. :( |
sorry for rushing to give you a bad review. But how can I download and install Because I tried to edit csproj Currently on Visual Studio Installer Windows 11 SDK version 10.0.26100.0 is the latest, I can't choose other versions at all. (Maybe it only exists in beta versions? I haven't checked it myself). |
Once again, you are modifying the wrong thing. You should not change your target framework. Just follow exactly the steps I provided in #923 (comment). Only add For instance, if you have: <TargetFramework>net8.0-windows10.0.22621.0</TargetFramework> Then leave that as is and just also add this: <WindowsSdkPackageVersion>10.0.22621.41</WindowsSdkPackageVersion> That's it. |
I don't think this issue should be closed. Others, like I did, are going to miss this because it is not an open issue, and will have to search closed issues. And in my humble opinion, it is an open issue that this "stable" release relies on a preview of the SDK. |
I pinned this issue yesterday for visibility. It's closed because it's not an issue with the MVVM Toolkit itself.
It does not. There are no references anywhere in the .NET Community Toolkit to preview builds of the .NET SDK. The VM image used in the pipeline that builds the repo doesn't have access to the preview of the .NET SDK either. This is the same exact issue that WinAppSDK 1.6 will also have when they release in stable soon: it will not work correctly for people using a .NET SDK that has not been updated. The only difference is that WinAppSDK includes a custom target that generates a build error to detect that scenario, whereas the MVVM Toolkit does not. But the point is that without either overriding the Windows SDK package version manually, or updating the .NET SDK to a version that knows about the new SDK projections, things will not work. |
I put this `
` |
@Sergio0694 fair enough, I misunderstood one of your earlier comments & missed the pin. Still can't get it to work w/ workaround, but I'm gonna wait 'til all this shakes out. I have enough trouble getting my own code to work. |
This should be opened again |
@eduardoagr you did not set the correct values. Please follow my instructions in #923 (comment) and #923 (comment). |
@Sergio0694 I did `
|
You did not. Like I clearly said in both my comments, especially in #923 (comment):
In your screenshot, you're using |
@Sergio0694 Than you and sorry for the trouble, are you considering adding this, for future releases |
No worries. No, this is not something that we'll add to the MVVM Toolkit. Like I explained in #923 (comment), this is a problem in outdated versions of the .NET SDK. As soon as the new update for the .NET SDK is released next month, this will just work with no changes needed. Manually setting the package version is a temporary workaround, but you should remove it when the new .NET SDK is out (as you don't want to hardcode a package version that will be eventually outdated) 🙂 |
Used workaround from CommunityToolkit/dotnet#923
Just change Works Well. |
This comment was marked as abuse.
This comment was marked as abuse.
There's no need to use that tone. We did not realize this would be an actual issue before we released the package, that's why the disclaimer doesn't mention it. I've unlisted the package on NuGet for the time being, and will list it again after the servicing .NET SDK update. That should help minimize issues in the meantime. I'll also mention this in the release notes just in case. |
@Balkoth dude how can you be a developer with that attitude? This is not anyone fault and @Sergio0694 is only trying to help. I had to bother him a couple of times times, and you know what this is probably the best package we have for Windows development. Do you think you are acomplinshing anything by using that tone? |
see CommunityToolkit/dotnet#923 As soon as the new update for the .NET SDK is released next month, this will just work with no changes needed. Manually setting the package version is a temporary workaround, but you should remove it when the new .NET SDK is out (as you don't want to hardcode a package version that will be eventually outdated).
me work well, thankyou @Sergio0694 yes, i understand people are upset, I postponed a project for a week, me frustrated but that's because me overlooked something. pardon the english. |
SDK 1.6 just released, if someone can test it now... |
The release notes mention needing the .NET SDK version > 8.0.400 (or the "temporary workaround" of the WindowsSdkPackageVersion). I verified that I have .NET SDK > 8.0.400 - 8.0.401 specifically (and only that version). However, I still receive the original error. Is this fixed in .NET SDK > 8.0.400 ?
I restarted Windows. I deleted all /bin/ and /obj/ folders. I verified that the servicing release version number is the third part of the version number ( https://learn.microsoft.com/en-us/dotnet/core/releases-and-support#minor-releases ). I searched this repo and found no mentions of 8.0.401. Thank you! |
Ah, typo, I meant to say 8.0.403, fixed it! Also I'll be releasing a hotfix soon with a built-in diagnostics to help out 🙂 |
Hey everyone! Thank you all for the feedback. I've just published a new 8.3.1 hotfix update that includes the changes in #942. This is a new custom targets that will validate the Windows SDK package version and emit a helpful error message to spot issues right at build time. It will also tell you exactly which package version to set in case the one you have isn't compatible. Hope this helps! 🙂 |
Used workaround from CommunityToolkit/dotnet#923
Hi, after updating to the latest Visual Studio Version 17.11.5, the installed SDKs are updated: https://github.com/microsoft/CsWinRT/releases/tag/2.1.5.241003.1 For .NET 8 for example I have to use the .47 now: <WindowsSdkPackageVersion>10.0.19041.47</WindowsSdkPackageVersion> Hope that helps if some runs into the same problem after the update. |
Describe the bug
Hi,
After upgrading from 8.2.2 to 8.3.0, as soon I run my WPF application, I've got the following exception :
It crashes on the very first line of OnStartup method :
IHost host = CreateHostBuilder().Build();
There seems to be something wrong related to WinRT.Runtime.
Thanks
Regression
8.2.2
Steps to reproduce
Expected behavior
App should start with no exception
IDE and version
VS 2022
IDE version
17.11.2
Nuget packages
Nuget package version(s)
8.3.0
Help us help you
No, just wanted to report this
The text was updated successfully, but these errors were encountered: