System.Windows.FrameworkElement.Style - wpf

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.

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.

Error in Upgrading 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.

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?

What can cause a form not to close itself?

I wonder just what can cause a form not to close.
I have a big form, with several TabControls, DataGridViews and many DataBound-Controls, at least 10 BindingSources are involved. (Thats the point why I can't post my code here, sorry).
Now, I have the problem, that somewhere in development (just refaktoring) the form stopped closing correctly. When I click on the Close-Button (Red-Cross-Box) I goes through FormClosing and FormClosed but then nothing more happens. VisualStudio2008 with debugging and halt on all Errors when thrown doesn't event mention something went wrong, the form just stays where it is.
What could cause such a behavior? It is NOT that e.Cancel in the FormClosing-Event is set!
After step by step merging my changes to another clean working copy, the form closes correctly, but an exception is thrown:
ArgumentNullException with Message: "The value cannot be null. Parametername: component". It is thrown in Form.Designer.Dispose upon calling the base.Dispose(disposing) line.
Seems to be something with the DataBinging, any hints welcome.
I'll put in the StackTrace, it is really any of the DataBound Controls, from what I understand out of the StackTrace, it is a TextBox - I do not get Framework Source Stepping enabled, so I can not figure out what TextBox breaks here.
bei System.ComponentModel.ReflectPropertyDescriptor.RemoveValueChanged(Object component, EventHandler handler)
bei System.Windows.Forms.BindToObject.CheckBinding()
bei System.Windows.Forms.Binding.CheckBinding()
bei System.Windows.Forms.Binding.SetBindableComponent(IBindableComponent value)
bei System.Windows.Forms.ControlBindingsCollection.ClearCore()
bei System.Windows.Forms.BindingsCollection.Clear()
bei System.Windows.Forms.ControlBindingsCollection.Clear()
bei System.Windows.Forms.Control.ResetBindings()
bei System.Windows.Forms.Control.Dispose(Boolean disposing)
bei System.Windows.Forms.TextBox.Dispose(Boolean disposing)
bei System.ComponentModel.Component.Dispose()
bei System.Windows.Forms.Control.Dispose(Boolean disposing)
bei System.ComponentModel.Component.Dispose()
bei System.Windows.Forms.Control.Dispose(Boolean disposing)
bei System.ComponentModel.Component.Dispose()
bei System.Windows.Forms.Control.Dispose(Boolean disposing)
bei System.ComponentModel.Component.Dispose()
bei System.Windows.Forms.Control.Dispose(Boolean disposing)
bei System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
bei System.ComponentModel.Component.Dispose()
bei System.Windows.Forms.Control.Dispose(Boolean disposing)
bei System.ComponentModel.Component.Dispose()
bei System.Windows.Forms.Control.Dispose(Boolean disposing)
bei System.Windows.Forms.TabControl.Dispose(Boolean disposing)
bei System.ComponentModel.Component.Dispose()
bei System.Windows.Forms.Control.Dispose(Boolean disposing)
bei System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
bei System.Windows.Forms.Form.Dispose(Boolean disposing)
bei My.BaseForm.Dispose(Boolean disposing) in BaseForm.Designer.cs:Zeile 30.
bei My.InheritedForm.Dispose(Boolean disposing) in InheritedForm.Designer.cs:Zeile 25.
bei System.ComponentModel.Component.Dispose()
bei System.Windows.Forms.Form.WmClose(Message& m)
bei System.Windows.Forms.Form.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Alright, got it, with Framework source stepping working (why ever it is so complicated) I could figure out what databinding failed. It was a databinding to a property of an object that was null at runtime. Thanks for the help.
PS: I'm sorry for those getting angry about me, but i stated this question explicitly for not getting those all-day answers. It is nice to remind me of these possible failures, but if I do state that it is not with this, don't be childisch to pretend on this.
I think one of your 10 binding sources has an error (in one of your many databound controls) and isn't releasing you from a field somewhere. VS isn't very transparent if there are errors in databinding and problems do get silently swallowed.
Although, if this is the case:
When I click on the Close-Button (Red-Cross-Box) I goes through FormClosing and FormClosed
then that somewhat contradicts my theory.
Why not try decoupling the databinding piece by piece and seeing if you can then close the form?
an example of how to prevent a form to be closed:
protected override void OnFormClosing(FormClosingEventArgs e)
{
e.Cancel = true;
base.OnFormClosing(e);
}
maybe this form is inherited and a base class prevent the form closing when some conditions are not satisfied.
Finally, if you don't achieve any solution, you can debug through the .NET Framework code and see what happens in the your form's OnClosing method.
Form can be prevented from closing even from your Form_Closing event handler.
private void Form1_Closing(Object sender, CancelEventArgs e)
{
e.Cancel = true;
}
Check whether you're setting e.Cancel to true .. anywhere in the code which is preventing it from closing.

Resources