-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Break Issue in Net9.0 #10020
Comments
@umanagarajan12, the issue is due to one of our changes to optimize the usage of DynamicResource #5610. At this juncture, you can opt-out from this behaviour to avoid the crash. Please include the following in the csproj. <ItemGroup>
<RuntimeHostConfigurationOption Include="Switch.System.Windows.Controls.DisableDynamicResourceOptimization" Value="true" />
</ItemGroup> Hope this resolves the current issue. In the meantime, we will continue to look further, identify the root cause, and ensure that this will be addressed in the next service release of .NET 9. cc: @batzen |
Ok. I finally found out what's happening here. The issue is that the code So it's either a bug in the StyleHelper, a bug in DeferredResourceReference or my approach to optimize dynamic resource usage is totally flawed. With my changes there is only one DeferredResourceReference per key, freezing that one only based on the value source passed in seems very random and i didn't pay enough attention when making my changes. Table of Frozen state based on BaseValueSourceInternal: |
As i can't compile this repo, again using
i can't test any changes... |
@batzen, thank you for looking into the issue. Regarding the build failure, I am not facing this issue on my machine. Can you help me with the configurations that you are using. Configurations on my machine: Will keep things updated on mitigation of the issue in .NET 9. |
@harshit7962 after updating main i now get different errors (same in three different places):
|
@batzen, this can be resolved by adding the char Try changing IndexOf('\\', 3) to IndexOf(L'\\', 3) We are waiting on some confirmation from the runtime before pushing this fix to the main as of now. |
@harshit7962 As the 9.0 branch already got it's branding updated to 9.0.1 does that mean you will ship 9.0 with my faulty optimizations enabled by default? |
This change in
Not sure what the negative consequences of this change might be, but always freezing freezables, no matter who asked for the resource, feels more logical. We really need test applications inside this repo. It's so complicated/time consuming to modify various apps to use the locally built WPF framework. At least the gallery application should be part of this repo. Currently there is not a single application that's part of this repo. |
Daily builds:
|
Merging the two repos or even adding a submodule wouldn't really help with that, you would have to have to update all the project files during build (which can arguably be done on a separate repo too) - and possibly could lower the value of tests if they don't run on a final installed runtime. However, I think I would support having an environmental variable pointing to the local WPF repo and updating the target file to pick it up. |
Also, if you need to run it under VS debugger (Use preview for .NET 10 by the way), set this for the env:
You can test either by referencing the libraries directly from the project (using private assets) or by just simply replacing it in the |
@miloush @h3xds1nz is there some page where all that is documented? @miloush Merging the repos would improve the inner cycle a lot. Now you have to dance around to align everything instead of having just one repo that manages everything. If the tests are also meant to run on just the installed runtime that should be the exception and special cased instead. |
Ah yeah I certainly don't trust the tests that way. I think they are mainly automated UI tests.
In the readme of the .NET Runtime repo, there is a dogfooding link to https://github.com/dotnet/runtime/blob/main/docs/project/dogfooding.md (it seems to be manually maintained though so still has 9.0 links). The desktop/other runtime links I found here: dotnet/installer#11040 (comment) |
Yeah I don't think so, though there's quite some stuff in dotnet/sdk though but if you don't know what exactly you're looking for, it ain't gonna give you much. There's no step-by-step straightforward guide on how to deal with all this. As for the testing, I basically selected few of my apps everytime, or wrote targeted tests / created targeted app where applicable because yeah, the tests can't be really trusted and since there's no real way to improve them atm, well, that's the best effort I could do. By the way, @batzen, I only just noticed that the WinDbg team used ControlzEx for the "new" GUI, so don't break it, alright? They're close, on .NET 8 at the moment, so it would be good to still be able to use it, I don't wanna go back 20 years again. 😀 |
Yes, the .NET 9 is going in with the optimizations enabled. The code closure for the same was a couple of weeks back, prior to our knowledge of the issue. We are in talks to fast forward the next service release to make amends in this regards. |
@batzen, we have quite a few tests here. Agreed that there are some gaps in test infrastructure and we would like to cover them up as much as possible. We are also working to improve our unit tests in this repository itself. The README in test repository offers initial steps to get started with the testing. Please let us know if any more information is required on testing front. (There are possibly some gaps in documentations, will try to update them by this week). @umanagarajan12, Removing the |
@batzen, regarding the fix, wouldn't we unconditionally seal the value via
Also, Can you help us with the issues you are encountering here? |
Yes, that's exactly what my changes are about.
Well, as far as i remember the gallery app crashed with my changes, even though not a single test seems have to have failed during the test runs. |
@batzen, we had the suggested fix tested and found multiple failures. I have created a sample repro from one of those failures, please find it here. On starting the test you could see the following failure
which I believe clearly suggests that the fix is not enough. Since we are closing in on the next service release, we would like to discuss the mitigation of this failure first before looking for the cause and solution. We are inclining towards removal of this feature for .NET 9 completely given the unknowns, either by opt-in or reverting the changes altogether. Thoughts? |
Will have a look at the repo during the weekend. My suggestion is: Disable my changes by default, so make it opt-in. For .NET 10 or, depending on the amount of required changes, a .NET 9 servicing release I can try to fix the issues we encounter or try a different approach to improve the performance. |
Making something opt in has non-trivial costs. One of them is to actually do the opt in, but then also documenting it and the risks so that they can be known, and given the history of opt ins, it is forever. |
@miloush The switch which enables opt-in/opt-out would be removed/it's default changed as soon as we know it's working properly. |
@harshit7962 I found a completely different approach to solve the majority of the performance issues i tried to solve with my initial changes. My tests didn't show any significant increase in memory consumption by doing so, most likely because the use of dedicated lists per resource key also decreases the "empty" space consumed by them because there are only a few entries per list and their grow, in regards to reserved capacity, is way lower than before. I could create a PR for these changes and replace my original approach with the new approach. |
Description
We've updated all our projects to support .NET 9.0. Our projects use a custom theme, which has been causing issues specifically in .NET 9.0, even though the same setup works seamlessly in .NET 8.0 and other frameworks. We've attached sample projects to illustrate this issue.
Replication Procedure
Screenshot
WpfAppNet90.zip
WpfAppNet80.zip
The text was updated successfully, but these errors were encountered: