Blend Hangs When Opening Project with Catel 3.6

Topics: Issues / bugs
Apr 29, 2013 at 6:47 PM
I have recently upgraded my project to use the latest beta of Catel 3.6 (was on 3.5). I also recently upgraded Visual Studio 2012 to Update 2. One or both of these changes has caused my project to hang Expression Blend 4 when I open it. This never used to happen.

It appears it may be a deadlock issue, although I am having a hard time nailing it down because none of my code is in the stack trace when I debug with VS attached to Blend and 'Break All' during the hang. To make matters worse, the top item on the call stack is a managed to native transition. Most of the stack is PresentationFramework or Microsoft.Expression stuff, but the last several calls in the stack are related to the ServiceLocator:
    [Managed to Native Transition]  
    mscorlib.dll!System.Reflection.RuntimeModule.GetTypes() + 0x5 bytes 
    mscorlib.dll!System.Reflection.Assembly.GetTypes() + 0x3e bytes 
    Catel.Core.dll!Catel.Reflection.TypeCache.InitializeTypes(bool forceFullInitialization, System.Reflection.Assembly assembly) Line 420 + 0x11 bytes  C#
    Catel.Core.dll!Catel.Reflection.TypeCache.TypeCache() Line 69 + 0xb bytes   C#
    [Native to Managed Transition]  
    [Managed to Native Transition]  
 Catel.Core.dll!Catel.IoC.ServiceLocatorAutoRegistrationManager.ServiceLocatorAutoRegistrationManager(Catel.IoC.IServiceLocator serviceLocator) Line 84 C#
    Catel.Core.dll!Catel.IoC.ServiceLocator.ServiceLocator() Line 178 + 0x19 bytes  C#
    Catel.Core.dll!Catel.IoC.ServiceLocator.Default.get() Line 221 + 0x16 bytes C#
    Catel.Core.dll!Catel.ModuleInitializer.Initialize() Line 27 + 0x6 bytes C#
    Catel.Core.dll!<Module>.<Module>() + 0x17 bytes 
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    Catel.MVVM.dll!<Module>.<Module>() + 0x17 bytes 
The specific line of code in Catel where the hang occurs is in ReflectionExtensions.assembly.cs in the GetTypesEx method:
return assembly.GetTypes();
If I modify this method like so, Blend opens my project:
            if (EnvironmentHelper.IsProcessCurrentlyHostedByExpressionBlend())
              return null;
                return assembly.GetTypes();
I know some work has been done on the ServiceLocator lately, so maybe something changed that triggered this behavior?
Apr 30, 2013 at 8:03 PM
Ok, I am going to kill the AutoRegistrationManager in design time.
Apr 30, 2013 at 8:04 PM