locked
Designer (both Blend and VS2012 RTM) report unhandled exception

    Question

  • Hi!

    I've been getting this exception for a while now. I've just tried to empty my App.xaml and working with a brand new user control, and still getting it. Can someone point me into the right direction?

    Thanks in advance,
    Fab

    Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteException

    Late bound operations cannot be performed on fields with types for which Type.ContainsGenericParameters is true.


       at System.Reflection.RtFieldInfo.InternalGetValue(Object obj, StackCrawlMark& stackMark)   at System.Reflection.RtFieldInfo.GetValue(Object obj)   at Microsoft.Expression.WindowsXamlPlatform.WindowsUIXamlPlatformMetadata.<>c__DisplayClassc.<GetPropertyImplementation>b__6()   at Microsoft.Expression.WindowsXamlPlatform.WindowsUIXamlPlatformMetadata.<>c__DisplayClasse.<GetPropertyImplementation>b__7()   at Microsoft.Expression.WindowsXamlPlatform.WindowsUIXamlPlatformMetadata.GetPropertyImplementation(ITypeResolver typeResolver, Type type, String propertyName, ClrPropertyImplementationBase clrImplementation, MemberAccessTypes access)   at Microsoft.Expression.DesignModel.Metadata.MemberCollection.ApplyToAllProperties(ApplyToPropertyDelegate action)   at Microsoft.Expression.DesignModel.Metadata.MemberCollection.AddAllPropertiesIfNecessary()   at Microsoft.Expression.DesignModel.Metadata.MemberCollection.GetMember(MemberType memberTypes, String memberName, MemberAccessTypes access)   at Microsoft.Expression.DesignModel.Metadata.ProjectContextType.GetMember(MemberType memberTypes, String memberName, MemberAccessTypes access)   at Microsoft.Expression.DesignSurface.UserInterface.PropertyMerger.GetPropertiesFromSelection(IEnumerable`1 selectedSceneNodes, Boolean includeStatics)   at Microsoft.Expression.DesignSurface.UserInterface.PropertyMerger.GetMergedProperties(IEnumerable`1 selectedSceneNodes, Boolean includeStatics)   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.PropertyInspectorModel.GetPropertiesToShowInternal(IReadOnlyList`1 selectedObjects)   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.PropertyInspectorModel.GetPropertiesToShow(IReadOnlyList`1 selectedObjects)   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.PropertyInspectorModel.UpdateOnSelectionChanged(Boolean forceUpdate, Boolean shouldCloseOpenTransactions, Boolean clearAddedProperties)   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.PropertyInspectorModel.UpdateSelectionCore(Boolean forceUpdate, Boolean shouldCloseOpenTransactions, Boolean clearAddedProperties)   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.PropertyInspectorModel.UpdateSelection(Boolean forceUpdate, Boolean shouldCloseOpenTransactions, Boolean clearAddedProperties)   at Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.PropertyInspectorModel.PropertyManager_MultiplePropertyReferencesChanged(Object sender, MultiplePropertyReferencesChangedEventArgs args)   at Microsoft.Expression.DesignSurface.Properties.PropertyManager.FireAllPropertyChangedEvents(SceneUpdatePhaseEventArgs args)   at Microsoft.Expression.DesignSurface.Properties.PropertyManager.SelectionManager_LateActiveSceneUpdatePhase(Object sender, SceneUpdatePhaseEventArgs args)   at Microsoft.Expression.DesignSurface.ViewModel.SceneUpdatePhaseEventHandler.Invoke(Object sender, SceneUpdatePhaseEventArgs args)   at Microsoft.Expression.DesignSurface.Selection.SelectionManager.FireLateActiveSceneUpdatePhase(SceneUpdatePhaseEventArgs args)   at Microsoft.Expression.DesignSurface.Pipeline.SceneViewUpdateScheduleTask.UpdateLate()   at Microsoft.Expression.Utility.Scheduler.ScheduleTask.Update()   at Microsoft.Expression.Utility.Scheduler.SchedulingService.DispatchTasksAtPriority(DispatcherPriority priority)   at Microsoft.Expression.Utility.Scheduler.SchedulingService.DispatcherToken.Dispatch(Object arg)   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)   at System.Windows.Threading.DispatcherOperation.InvokeImpl()   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)   at System.Windows.Threading.DispatcherOperation.Invoke()   at System.Windows.Threading.Dispatcher.ProcessQueue()   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)   at System.Windows.Threading.Dispatcher.Run()   at System.Windows.Application.RunDispatcher(Object ignore)   at System.Windows.Application.RunInternal(Window window)   at System.Windows.Application.Run(Window window)   at System.Windows.Application.Run()   at Microsoft.Expression.DesignHost.Isolation.IsolationProcess.RunApplication()   at Microsoft.Expression.DesignHost.Isolation.IsolationProcess.DesignProcessViewProvider.<>c__DisplayClass7.<applicationView_Activated>b__6()   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)   at System.Threading.ThreadHelper.ThreadStart()

    Thursday, September 06, 2012 7:37 PM

Answers

  • Ok, few more hours and I got to the bottom of the problem.

    I had a Behavior base class, that was a generic class that defined a dependency property and this was the problem. I moved the dependency property into a new class and the generic class derives from that one now and this solved the issue.

    • Marked as answer by TheFabFab Saturday, September 08, 2012 10:50 AM
    Saturday, September 08, 2012 10:50 AM

All replies

  • Hello,

    is this a project you can share with me for repro or do you have some repro steps?   If you can share this project please send to mikewong at microsoft.com. 

    much appreciated,

    mike

    Thursday, September 06, 2012 10:47 PM
    Moderator
  • Hi Mike,

    unfortunately it's impossible to share the whole project.

    I would be happy to create a repro project but I have no idea which part of the application caused this. As I wrote above, I am getting it even with a new user control and everything commented out in the app.xaml. I just can't imagine how any parts of my application could interfere in that scenario?

    Can you give me any pointers where to look? Is it related to data context, custom controls, app resources?

    Ah, one more piece of information: the designer does load up correctly at first and only shows the exception a couple of seconds later.

    Fab

    Friday, September 07, 2012 7:58 AM
  • I spent a few hours tracking this down. (TG for source control!)

    I found that a particular line I added in that changeset was causing this. The line removed an event handler when a custom control was unloaded.

    It has probably something to do with the order the objects were disposed (I'm using SharpDx in this control), because when I moved the line to the top of the method, everything started to work.

    Saturday, September 08, 2012 8:46 AM
  • A little correction: the line above helped with the VS2012 designer, still getting the same issue in Blend. :(
    Saturday, September 08, 2012 9:25 AM
  • Ok, few more hours and I got to the bottom of the problem.

    I had a Behavior base class, that was a generic class that defined a dependency property and this was the problem. I moved the dependency property into a new class and the generic class derives from that one now and this solved the issue.

    • Marked as answer by TheFabFab Saturday, September 08, 2012 10:50 AM
    Saturday, September 08, 2012 10:50 AM