locked
Sketchflow ObjectDataSource class from separated assembly = runtime crash RRS feed

  • Question

  • Hi,

      I'm creating a sample where I have two additional projects, and entities one and a viewmodels one, the view model sample I'm creating instantiate a simple list of persons (name, plus lastname).

      If I create an objectdatasource based on that class (from the separate assembly MyViewmodel), everything works pretty well on design mode, but if I try to run I get a hard crash.

       If I just move that class to the Screens project, everything works fine.

       Is that a known Sketchflow bug?

    Wednesday, September 15, 2010 12:20 PM

All replies

  • Not a known bug. Can you run the project with a debugger attached and post the stack trace?
    Thursday, September 16, 2010 12:28 PM
    Moderator
  • Hi

     

    Details about the error I get, if you want I can send you the dummy sample, it's interesting to try, with a Viemodel inside the same project everything goes fine, with an external project get the bad crash (exactly the same code), more details about the error:

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; MS-RTC LM 8)
    Timestamp: Thu, 16 Sep 2010 12:34:04 UTC


    Message: Unhandled Error in Silverlight Application Element is already the child of another element. [Line: 0 Position: 0]   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at DataBindingVMScreens.MainPage.InitializeComponent()
       at DataBindingVMScreens.MainPage..ctor()
    Line: 1
    Char: 1
    Code: 0
    URI: http://localhost:3020/Default.html

    Stack:

      [External Code] 
    > DataBindingVM.Screens!DataBindingVMScreens.MainPage.MainPage() Line 18 + 0x8 bytes C#
      [External Code] 

    Thursday, September 16, 2010 12:37 PM
  • If you can send the sample project we would be happy to take a look at it.  first.last@microsoft.com using my name.

    Thursday, September 16, 2010 12:46 PM
    Moderator
  • The answer to this problem was that the project had a chain of references like this:

    A -> B -> C -> D

    Where A is the main project that produces the XAP. The silverlight compiler doesn't pull in assemblies into the XAP file from that chain. So C and D were not getting included in the XAP. When silverlight tried to load types from C and D, it couldn't find them.

    The solution is to add project references from A to C and D, so they get included in the XAP file.

    Right click references in project A, pick add reference, project reference, select C and D.

     

    Thursday, September 16, 2010 1:41 PM
    Moderator