Search code examples
c#visual-studio-2010silverlight-5.0business-application

Error thrown when trying to run Silverlight Business Application


I am at my wits' end about this error. I cannot for the life of me figure out what the problem is. Even when I have stripped down all the changes I've made so it's back to the basic App that's provided on creation it still has the same error. There was one time I managed to sort it but I don't know what I did to get that.

If someone can help me understand this error I would be extremely appreciative!

I can't even seem to debug on a breakpoint as it doesn't even reach any of the breakpoints I've set. The message is following:

Error
Exception has been thrown by the target of an invocation.

Error Details
   at System.Windows.Navigation.PageResourceContentLoader.EndLoad(IAsyncResult asyncResult)
   at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)
Caused by: Exception has been thrown by the target of an invocation.

   at System.Windows.Navigation.PageResourceContentLoader.EndLoad(IAsyncResult asyncResult)
   at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)
Caused by: Exception has been thrown by the target of an invocation.

   at System.Windows.Navigation.PageResourceContentLoader.EndLoad(IAsyncResult asyncResult)
   at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)

Has anyone else come across this? Does anyone know how to fix it so I can continue to work on the same project once it is thrown?

Thank you


Solution

  • In conclusion:

    This particular error means there is something wrong in the xaml and neither Visual Studio nor Expression Blend can/will give the source of the error and debugging won't help. It is very likely to do with a binding issue. Anyone with this same error would do well to thoroughly check the xaml code.

    My problem was compounded by the fact that my default browser (SRWare Iron) was caching the 'website' and would only show an initial version of the application so any changes I made were not updating in what I saw (thus the error would continue to show no matter what I changed in the code). As you can imagine very frustrating! I didn't realise this until I changed the xaml to show a visual difference and the changes weren't shown. - Interestingly this only happened in VS, Expression Blend would load the newest version correctly.

    I made IE the default browser (link to method) so the second issue is no longer a problem and the error has magically disappeared (because I fixed the code a long time ago).

    I hope this helps anyone who may have either the first or second problem. - While scouring the web I did find a few others who had the browser problem and no-one knew anything about it, so I hope this solves it.