Hello,
We're developing a .NET 4.0 WPF application and we ran into very strange problem. We're simply calling Assembly.GetTypes but for some reason it never completes. Also, it is using 100% of one processor core.
Even the following simple console application never completes:
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var assembly = typeof(MyLibrary.MyType).Assembly; var types = assembly.GetTypes(); } } }
In this case MyLibrary.MyType lives in another assembly to which I have reference in this console application. Also, the assembly has many other references but I have understood that if there were any problems in loading these other references, an exception should be thrown instead of hanging infinitely.
I turned Just My Code off from debugging options and it seems that following line is causing the problem:
SystemEvents.cs line 1569 int ret = UnsafeNativeMethods.MsgWaitForMultipleObjectsEx(0, IntPtr.Zero, 100, NativeMethods.QS_ALLINPUT, NativeMethods.MWMO_INPUTAVAILABLE);
What could be the problem? Is this a bug in .NET 4.0? Is there a way to debug this somehow? On a computer that has .NET 4.5 installed this works perfectly. We have tested this both on Win7 and Win8.
Thanks!