Reputation: 1722
This new SL app is the entry point of my solution, and basically loads the mainpage from the other xap file. Checks for updates, etc.
The problem is that the RIA Services generated code for Loader is not the same code as the code for MyApp
The generated code for MyApp contains the following namespaces:
The generated code for Loader contains the namespace:
The following line of code in Loader - App.cs throws InvalidOperationException.
WebContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);
The error msg for the exception is:
The DomainContextType is null or invalid and there are no contexts generated from
AuthenticationBase<T>
Upvotes: 3
Views: 1358
Reputation: 3854
I've had this same problem (with a similar setup) today. After looking around a little bit, I found this post on the silverlight forums which has the answer (look in the bottom for the solution, since there were some API changes in RIA Services).
Long story short, the issue is that your WebContext can't find the DomainContext (in this case an AuthenticationContext
) that handles LoadUser
in your case. to solve this problem you'll need to add the following to your App.xaml
:
<Application.ApplicationLifetimeObjects>
<dmnsvc:WebContext>
<dmnsvc:WebContext.Authentication>
<appsvc:FormsAuthentication>
<appsvc:FormsAuthentication.DomainContext>
<!--Your AuthenticationContext here-->
</appsvc:FormsAuthentication.DomainContext>
</appsvc:FormsAuthentication>
</dmnsvc:WebContext.Authentication>
</dmnsvc:WebContext>
</Application.ApplicationLifetimeObjects>
Hope this helps :)
Upvotes: 2