0

I have found a strange thing. If you create an EF datacontext you get some assembly resolve failed events like this: Any EF will do my sample has: var db = new NorthwindEntities();

System.Xml.resources, Version=4.0.0.0, Culture=hu-HU, PublicKeyToken=b77a5c561934e089 System.Data.Entity.resources, Version=4.0.0.0, Culture=hu-HU, PublicKeyToken=b77a5c561934e089

As you see my thread's CurrentUICulture is "hu-HU", and it runs on Windows XP anyway.

As a workaround if i set Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; and assembly resolve events stop to fire.

Could someone know why EF datacontext related to culture? Or how can I prevent resolve events fire when i keep my threads on the default "hu-HU" locale?

Laszlo Boke
  • 1,319
  • 1
  • 10
  • 22
  • not exactly sure, but I'm guessing it has to do with messages from a resource file (like error messages, etc.). – David Hoerster Sep 04 '12 at 10:50
  • So i need to install Microsoft .NET Framework 4 Language Pack for my locale? ("HU") – Laszlo Boke Sep 04 '12 at 11:41
  • I'm not sure (which is why I did not enter this as an answer) - I've never installed a language pack. Are you getting an error, or are you just seeing the event fire and you're curious as to why it's firing? If that's the case (curiosity), then I think installing the language pack will *not* prevent the event from firing...but you will get language specific messages available. Again, just a guess. – David Hoerster Sep 04 '12 at 11:55
  • There is no error at all. Framework probably tries to resolve the localized resource, but if it is not found it will go with English. Beside curiosity maybe there is a performance bonus if we could avoid this resource resolving. That's why my guess was to install language pack, so framework will resolve resource and won't fire assemblyresolve event (Occurs when the resolution of an assembly fails.) – Laszlo Boke Sep 04 '12 at 12:27
  • Loading those resources is probably a small hit to performance once (walking the dependency tree and JITing the components). After that, the events will continue to raise, but the amount of time spent in that event handler will probably be insignificant. Again, just a guess. I suppose it would matter if you're working on some high-performant app...in which case, you'd be better off going without EF and getting as close to the TDS as possible (DataReader). – David Hoerster Sep 04 '12 at 13:08
  • Probably it works in this way by design, thanks for your suggestions. – Laszlo Boke Sep 04 '12 at 13:29

0 Answers0