0

I have a service in .NET 4.0. (C# ) and I need to load new assembly coded in .NET 4.5. Using a method Invoke (Methodinfo / Reflection) the service presents the following error message: "Exception has been thrown by the target of an invocation." In InnerException I got "System.TypeInitializationException: The type initializer for "System.Windows.FrameworkElement' threw an exception." Can anyone help me?

--> Exception Message: Exception has been thrown by the target of an invocation. --> Complete Inner Exception: System.TypeInitializationException: The type initializer for 'System.Windows.FrameworkElement' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Windows.Media.Transform' threw an exception. ---> System.ComponentModel.Win32Exception: The operation completed successfully at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks) at System.Windows.Threading.Dispatcher..ctor() at System.Windows.DependencyObject..ctor() at System.Windows.Media.Transform..cctor() --- End of inner exception stack trace --- at System.Windows.FrameworkElement..cctor() --- End of inner exception stack trace --- at System.Windows.Controls.UserControl..cctor()

adtteles
  • 49
  • 1
  • 6
  • 1
    That service is definitely not a happy home for a WPF code. Seeing GetStockObject() fail is very unusual, so unusual that Microsoft never discovered the broken exception reporting. Which produced the silly "The operation completed successfully" message. Then again, a service is never an appropriate home for GUI code. – Hans Passant Oct 08 '13 at 00:56
  • 1
    Found some references:
    http://marcgravell.blogspot.nl/2012/09/iterator-blocks-missing-methods-and-net.html
    http://stackoverflow.com/questions/12631353/loading-an-assembly-targetted-for-net-4-5-on-a-net-4-0-app-domain
    – Tico Oct 07 '13 at 23:19

0 Answers0