0
votes

I get an exception in VS2010 designer when I use user control with code which contains HtmlPage.RegisterScriptableObject() method. I've tried to move that code from control constructor to other methods but it doesn't help. I am using Silverliht 4.

Now I call HtmlPage.RegisterScriptableObject("MainPage", this) in UserControl_Loaded handler.

The exception message is

at System.Windows.Browser.ManagedObject.CreateHandle() at System.Windows.Browser.ManagedObject.GetObjectHandleAddRef() at System.Windows.Browser.HtmlPage.RegisterScriptableObject(String scriptKey, Object instance, Boolean isRestricted) at System.Windows.Browser.HtmlPage.RegisterScriptableObject(String scriptKey, Object instance) at SL_Form.forms.VT_kv_2010.UserControl_Loaded(Object sender, RoutedEventArgs e) in C:\SL2\SL_Form\forms\1VT_kv.xaml.cs:line 1533 at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

I can't use designer due to this bag. Although project builds without any errors and works fine. Any help will be appreciated.

John Smith

1

1 Answers

0
votes

can you just put it inside an if not designer mode? that's (afaik) the typical approach for situations like this.

http://msdn.microsoft.com/en-us/library/system.componentmodel.designerproperties.isindesignmode%28v=VS.95%29.aspx