OOB Navigation Error - Arg_TargetInvocationException
-
Thursday, March 08, 2012 5:09 PM
I have a Silverlight 4 application built off the Silverlight Business Application template. On one view I have a comboBox that I have page names loaded into for navigation to other views.
<ComboBox Name="cbNav" Height="27" Width="150" Margin="10,6,0,6" FontSize="11" FontWeight="Bold"> <ComboBoxItem Content="Admin Links" IsSelected="True"/> <ComboBoxItem Content="Site Notes" /> <ComboBoxItem Content="Site List"/> <ComboBoxItem Content="Customer List"/> <ComboBoxItem Content="Group Admin"/> <ComboBox.Effect> <DropShadowEffect/> </ComboBox.Effect> </ComboBox>
Here is the code behind:Private Sub cbNav_SelectionChanged(sender As System.Object, e As System.Windows.Controls.SelectionChangedEventArgs) Handles cbNav.SelectionChanged If cbNav.SelectedIndex > 0 Then If cbNav.SelectedIndex = 1 Then objApp.gvTitle = "Site Notes" NavigationService.Navigate(New Uri("/Management/Notes", UriKind.Relative)) 'Notes End If If cbNav.SelectedIndex = 2 Then objApp.gvTitle = "Site List" NavigationService.Navigate(New Uri("/Management/MSites", UriKind.Relative)) 'Site List End If If cbNav.SelectedIndex = 3 Then objApp.gvTitle = "Customer List" NavigationService.Navigate(New Uri("/Management/MCustomer", UriKind.Relative)) 'Customer List End If If cbNav.SelectedIndex = 4 Then objApp.gvTitle = "Equipment History Groups" NavigationService.Navigate(New Uri("/Management/MEquipmentMapAdmin", UriKind.Relative)) 'Customer List End If End If End Sub
Everything works great in browser, but when I try to run it OOB I get a Arg_TargetInvocationError, but only when Iselect the Site List entry that navigates to /Management/MSites. The other pages load fineI have other simular applications that run fine OOB, but I can't figure out what it different about this one.
All Replies
-
Tuesday, March 13, 2012 4:45 AM
Hi chasday,
Welcome to Silverlight Forum!
According to your description, the project can work well in browser but not in OOB. I have tried to reproduce your issue, but it works well. In order to resolve your issue, could you set some breakpoints at the code below:
NavigationService.Navigate(New Uri("/Management/Notes", UriKind.Relative)) 'NotesAnd
NavigationService.Navigate(New Uri("/Management/MSites", UriKind.Relative)) 'Site ListThen compare the difference of the result. Besides, please whether the url /Management/MSites exists.
If it doesn't help you, please try to catch the exceptions as follows:
1. Open Visual Studio and click Debug menu->Exceptions.
2. Check "Common Language Runtime Exceptions".
In this way, the debugger will stop when an exception is thrown.
Best wishes,
-
Wednesday, March 14, 2012 11:22 AM
Cathrine,
Thanks for the detailed response. I wasn't able to use your suggestions because I couldn't get the sllauncher command to work so that I could debug it in OOB mode.
As a work a round I resorted to commenting out the code until the view loaded, then see what broke it. It turned out I used a
Dim m As HtmlElement = HtmlPage.Document.GetElementById("MyIFrame")
statement so that I could reference an Iframe on the host page and that crashed the page when running OOB. I solved this by using
If App.Current.IsRunningOutOfBrowser Then Else Dim m As HtmlElement = HtmlPage.Document.GetElementById("MyIFrame") End If
and everything worked fine.
-
Wednesday, March 14, 2012 9:34 PM
Hi chasday,
Very glad to hear that you have resolved your issue and thank you for sharing your solution.

