-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Adding PropertyChange.Fody to WPF project results in various native memory issues #655
Comments
can u re read the issue template and take all the required steps https://github.com/Fody/.github/blob/master/.github/ISSUE_TEMPLATE/bug_report.md |
Sorry. Updated --- trying to do the best format. What's annoying is that even if I essentially disable the weaver via the filter attribute by specifying only a non-existing namespace, the hardware projects still throw exceptions. |
can you share a minimal stand alone solution that reproduces this issue? |
I will try. But in the mean time can I at least get a suggestion? |
Suggestion: compare the IL of your assembly when PropertyChanged.Fody is enabled and when it's disabled. Check to see if anything else than your ViewModels is affected. Another idea: somehow the lifecycle of your native memory stuff is associated with the View Models. Adding property changed notifications might keep VM's from being garbage collected (even if they should be) and this might lead to errors (though in that case I'd rather expected out-of-memory than anything else). One more would be that WPF accesses properties which in turn access native memory after you've freed the memory. |
Taking a look with a memory profiler, I found something very interesting. When the process builds normally without PropertyChanged.Fody, the maximum addressable memory is 4GB, however with PropertyChanged.Fody it is 2GB. The application btw is compiled with ANYCPU + Prefer32 bit which I think adds the /LARGEADDRESSAWARE build flag by default. This process needs to address 4GB. How do I get the package to make sure that happens? Btw, I found this out by simply draining the memory to see at what level the app crashes. So 4GB without Fody, 2GB with Fody. |
I have confirmed that PropertyChanged.Fody does in fact affect the flags that the application get's compiled with. My workaround was to install the LargeAddressAware NuGet package and add the following properties to my .csproj It would however be nice if Fody would not have led to this unexpected change to begin with. Please fix. |
@timbilt this looks like a bug in cecil. can u raise an issue here https://github.com/jbevain/cecil |
@jbevain fyi |
Looks like this is already reported: jbevain/cecil#620 |
ok given this is tracked upstream, i will close this |
First of all please pardon me if this format is a little bit off --- I am trying to stick to the format and provide as much info as possible.
I am using Visual Studio 2019 (MSBUILD 16.0) and have a solution that has a few projects.
2 Core base projects: .NET standard 2.0
All other projects: .NET Framework 4.7.2
Some of the base projects control hardware devices via SDKs
Base classes that implement INotifyPropertyChanged exist in both .NET Standard 2.0 projects.
Intermediate base classes exist in a .NET Framework 4.7.2 project
All concrete implementations are in the main WPF project which is .NET Framework 4.7.2
Due to the nature of the hardware projects that are failing, it's hard to reproduce in a sample app. Does this have something to do with the fact that 2 base projects are .NET Standard 2.0? Do I have to use specific versions of PropertyChanged.Fody in each project?
The text was updated successfully, but these errors were encountered: