简体   繁体   中英

problem with wpf databinding when using useLegacyV2RuntimeActivationPolicy

I have some existing code which uses wpf and databinding for the gui. When using the code it works fine, it consist of several menu where you can view pictures and other stuff, and this is done by using databinding. No problem there! But I would like to add more functionality by using Enity framework, and thereby .NET 4.0. I have found that I need to add the following to my app.config, in order to keep the original assemblies(3.5 and lower)

 <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup> 

But when I add this, it affects the databinding and intermittently does not show the correct pictures when shifting through menus and stuff. Remove it and it works fine again.

I have been reading a bit about this, but still no where near a solution

Any ideas or suggestions?

Yes, that sounds like trouble. WPF depends on lots of mixed-mode code written in C++/CLI, glue for Milcore. I know that .NET 4.0 has several interop assemblies for WPF that have names imprinted with the .NET version number. Ugly stuff, it looked like they were battling versioning problems badly when I first noticed them. I'm guessing that your useLagecyV2RuntimeActionPolicy is messing this up, getting the wrong assembly loaded.

Not a great answer of course, but these are grungy details that are probably only known to the WPF group at Microsoft. Try to get a hold of them by filing a feedback report at connect.microsoft.com. Good luck, I suspect you'll need it. The "by design" hammer is easily swung with issues like this.

Btw: if you don't actually have your own mixed-mode C++/CLI assemblies that made you use that config element then be sure to remove it and work out an alternative solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM