Error in Upgrading Silverlight - silverlight

I've inherited a fairly big project that needed upgrading from Silverlight 2 to Silverlight 4. I recently ran into an error trying to test the project.
Microsoft JScript runtime error: Unhandled Error in Silverlight Application Set property 'System.Windows.FrameworkElement.Style' threw an exception. [Line: 257 Position: 27] at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at ESM.Visualization.MainPage.InitializeComponent()
at ESM.Visualization.MainPage..ctor()
at ESM.Visualization.App.Application_Startup(Object sender, StartupEventArgs 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 think there might be some files that went missing between Silverlight 2 and 4, but I'm not sure where to start looking for changes to fix. Any help would be appreciated.

Related

Windows Phone 8.1 app shows exception "Value does not fall within the expected range."

In first page I tap an image to view in large. This tapping event takes me to another second page. In this second page I zoom in or out the image. After that I press back key and come back to the first page. Then it throws this error message.
Value does not fall within the expected range.
System.ArgumentException: Value does not fall within the expected range.
at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
at MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)
at System.Windows.UIElement.TransformToVisual(UIElement visual)
at Microsoft.Phone.Controls.GestureListener.GetInverseTransform(Boolean includeOffset, UIElement target)
at Microsoft.Phone.Controls.GestureListener.OnPinchCompleted(ManipulationDeltaEventArgs lastPinchInfo, Boolean gestureCompleted)
at Microsoft.Phone.Controls.GestureListener.OnManipulationDelta(Object sender, ManipulationDeltaEventArgs 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 am trying to find out the reason and solution of this problem but failed. I am looking for fruitfull answers to this question.

Assigning x:Name to Thickness throws exception

Can anyone explain why this throws an exception?
<UserControl>
<Grid>
<Grid.Margin>
<Thickness x:Name="thickness" />
</Grid.Margin>
</Grid>
</UserControl>
If I remove the x:Name attribute, then it runs successfully.
Error details:
Message: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.NullReferenceException: Object reference not set to an instance of an object.
at SilverlightBindingTest.MainPage.InitializeComponent()
at SilverlightBindingTest.MainPage..ctor()
at SilverlightBindingTest.App.Application_Startup(Object sender, StartupEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
The Name attribute is a DependencyObject and as such can only be set on another DependencyObject.
Thickness is not a DependencyObject, so you cannot use the Name attribute.

Causes of intermitant Arg_ArgumentException on in Production deployment?

We have just recently deployed a Trusted, In-Browser, Silverlight 5 application to our Production webserver. We are getting fairly frequent ArgumentExceptions captured by the App.xaml.cs UnhandledException handler. So far we have been unable to determine the source of the exception.
We are not seeing the exception when running under the debugger (I have that explicitly enabled the exception for capture under Debug->Exceptions....). Some users see this error very frequently, while others never see the error. It doesn't seem to be a fatal error as the users can just click the OK button from the ErrorWindow that we display and everything functions normally.
To stop annoying the users, I have added a handler for ArgumentException types and just mark it as handled and continue on. However, I am still logging the errors and would really like to determine the actual source so that I can fix the problem. Just ignoring the exception doesn't seem like a long term solution.
The Stack trace is below and is the same for all ArgumentExceptions.
Any ideas on how I can troubleshoot better and determine the cause of this exception?
Thanks,
Tim
Unhandled Exception: [Arg_ArgumentException]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.10411.00&File=mscorlib.dll&Key=Arg_ArgumentException :
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, Double d)
at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)
at System.Windows.Data.BindingExpression.SendDataToTarget()
at System.Windows.Data.BindingExpression.SourceAcquired()
at System.Windows.Data.BindingExpression.PerformTargetLoaded()
at System.Windows.Data.BindingExpression.TargetLoaded(Object o, RoutedEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex

System.Windows.FrameworkElement.Style

got an exception when i call a silverlight xap in sharepoint. Hope anybody can help me out this problem. Here the exception:
Message: Unhandled Error in Silverlight Application Set Property
'System.Windows.FrameworkElement.Style' threw an exception. [Line: 84
Position: 335] at System.Windows.Application.LoadComponent(Object
component, Uri resourceLocator) bei
Project.MainPage.InitializeComponent() bei
Project.MainPage..ctor(String eldoradoUrl, String eldoradoUser) bei
Project.App.Application_Startup(Object sender, StartupEventArgs e)
bei MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex,
Delegate handlerDelegate, Object sender, Object args) bei
MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr
unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex,
String eventName)
And here is the xaml code line where the error supposed:
<fseld:EldoradoDocCreationView x:Name="ProtoEldoradoDocCreationView" Grid.Row="0"
MaxColumnCount="2" FieldMargins="34 5 5 5"
RestrictToProperties="ProcedureName, FileItemText"
CurrentItem="{Binding ProtoEldoradoDoc}" CommandButtonsVisibility="None"
Margin="25,18,47,0" FontSize="10" Height="69" VerticalAlignment="Top" />
Thanks for your replies in advance !
Does your Silverlight XAP work outside of Sharepoint? If no first correct the error outside, you will easier isolate the problem and may get more detailed exception information.
If it does work without Sharepoint then rather look at external assemblies that could contain styles that are not found in this context.

Silverlight Application Error 0x17F8 on ComboBox_DropDownOpened

I have several similar comboboxes with custom templates that display one custom control on the dropdown. Suddenly one of those controls have broken and they give me the following error when I open the combobox.
Message: Unhandled Error in Silverlight 2 Application Error 0x17F8. Debugging resource strings are unavailable. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50401.0&File=mscorrc.dll&Key=0x17F8 at <INSERT_NAMESPACE>.ComboBox_DropDownOpened(Object sender, EventArgs e)
at System.Windows.Controls.ComboBox.OnDropDownOpened(EventArgs e)
at System.Windows.Controls.ComboBox.OnIsDropDownOpenChanged(Boolean isDropDownOpen)
at System.Windows.Controls.ComboBox.OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
at System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
at System.Windows.Controls.ComboBox.ElementDropDownToggle_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Primitives.ToggleButton.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
Line: 1
Char: 1
Code: 0
As you can see this only happens in deployed release versions and on the machines with no development environments. The same release version (and debug version) is working on my development machine.
I wrapped everything on the DropDownOpened event handler inside a try-catch-block to get more information but the catch doesn't fire at all.
I tried to Google the error but so far haven't found anything that would be helpful. Any advice how to start solving this? Could this be related to Silverlight runtime version or something that should be installed on the release machines as well?
I managed to solve the issue. I installed Developer Runtime to the machine for the hope that it would reveal better error message from the Exception. And it did! The issue was in the code of the control that was being displayed in the combobox dropdown. I fixed the bug and it's now working fine. Apparently even the strangest error message can mean the simplest thing :)
I wonder if there is a drawback on having the developer runtime instead of the standard runtime?

Resources