“Unhandled Error in Silverlight Application Code: 4004 Category: ManagedRuntimeError

A Silverlight web application which has multiple child windows  poping up to handle various event on different pages, gave the following error:

“Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentException: Content for the URI cannot be loaded. The URI may be invalid.
Parameter name: uri
at System.Windows.Navigation.NavigationService.NavigateCore(Uri uri, NavigationMode mode, Boolean suppressJournalAdd, Boolean isRedirect)
at System.Windows.Navigation.NavigationService.Journal_Navigated(Object sender, JournalEventArgs args)
at System.Windows.Navigation.Journal.OnNavigated(String name, Uri uri, NavigationMode mode)
at System.Windows.Navigation.Journal.UpdateObservables(JournalEntry currentEntry, NavigationMode mode)
at System.Windows.Navigation.Journal.AddHistoryPoint(JournalEntry journalEntry)
at System.Windows.Navigation.Journal.AddHistoryPointIfDifferent(String newState)
at System.Windows.Navigation.Journal.CheckForDeeplinks()
at System.Windows.Controls.Frame.ApplyDeepLinks()
at System.Windows.Controls.Frame.Frame_Loaded(Object sender, RoutedEventArgs e)
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 had absolutely no clue why this was happening until I decided to break down the error situation.

PROBLEM:

The presence of a “<sdk:Frame />” control was the cause for all the headache.

Silverlight toolbox: Frame and rectangle controls

FIX:

Removing the Silverlight Frame control saved my day.

Follow this link to learn how to use the frame control correctly without causing errors: http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2009/04/02/silverlight-3-quick-tip-6-navigation-framework-and-uri-routing.aspx

The trick is to understand the navigation-framework-uri-routing thingy !

About anjalisreekumar

I am a software engineer interested to innovate more on automated tools for software engineering in practice. I am also a research student focusing specially on the requirements engineering domain, where the importance of automated requirements generation and validation against stringent business rules is my key research interest.
This entry was posted in Silverlight and tagged , . Bookmark the permalink.

2 Responses to “Unhandled Error in Silverlight Application Code: 4004 Category: ManagedRuntimeError

  1. I have been browsing online more than 2 hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. Personally, if all
    website owners and bloggers made good content as you did, the internet will be much
    more useful than ever before.

Leave a comment