Frage

Sometimes when my application tries to start, the ArgumentException "The parameter is incorrect" is thrown. Unfortunately the exception occurs randomly, so it is hard to fix it.

InnerException and StackTrace are empty :(.

Here is output:

'TaskHost.exe' (Managed): Loaded 'mscorlib.dll'
'TaskHost.exe' (Managed): Loaded 'System.Windows.RuntimeHost.dll'
'TaskHost.exe' (Managed): Loaded 'System.dll'
'TaskHost.exe' (Managed): Loaded 'System.Windows.dll'
'TaskHost.exe' (Managed): Loaded 'System.Net.dll'
'TaskHost.exe' (Managed): Loaded 'System.Core.dll'
'TaskHost.exe' (Managed): Loaded 'System.Xml.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\SmartLib.dll', Symbols loaded.
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\RestSharp.WindowsPhone.dll'
'TaskHost.exe' (Managed): Loaded 'Microsoft.Phone.dll'
'TaskHost.exe' (Managed): Loaded 'Microsoft.Phone.Interop.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\JeffWilcox.PhoneThemeManager.dll'
'TaskHost.exe' (Managed): Loaded 'System.Xml.Linq.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\System.Windows.Interactivity.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\Microsoft.Expression.Interactions.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\Microsoft.Phone.Controls.Toolkit.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\System.Threading.Tasks.dll'
A first chance exception of type 'System.MethodAccessException' occurred in mscorlib.dll
'TaskHost.exe' (Managed): Loaded 'System.Runtime.Serialization.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\WPExtensions.dll', Symbols loaded.
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\Microsoft.Phone.Controls.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\Silverlight_ZXing_Core.dll'
'TaskHost.exe' (Managed): Loaded '\Applications\Install\35353739-1684-48DB-A5D2-F849FC676154\Install\Microsoft.Threading.Tasks.dll'
A first chance exception of type 'System.MethodAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
'TaskHost.exe' (Managed): Loaded 'System.SR.dll'

Sometimes everything works fine, but sometimes I'm unable to run application 10 times in a row.

EDIT 1: Call Stack:

SmartLib.dll!SmartLib.App.Application_UnhandledException(object sender = {SmartLib.App}, System.Windows.ApplicationUnhandledExceptionEventArgs e = {System.Windows.ApplicationUnhandledExceptionEventArgs}) Line 348 + 0x5 bytes C# System.Windows.dll!MS.Internal.Error.CallApplicationUEHandler(System.Exception e = {"The parameter is incorrect. "}) + 0x30 bytes
System.Windows.dll!MS.Internal.Error.CallAUEHandler(uint hr = 2147942487, out uint bIsHandled = 0) + 0x6 bytes
[Native to Managed Transition]

EDIT 2: StackTrace:

at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
   at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
   at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
   at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
   at System.Windows.PresentationFrameworkCollection`1.Add(UIElement value)
   at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 index, DependencyObject container, Boolean needPrepareContainer)
   at System.Windows.Controls.ItemsControl.AddContainers()
   at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr unmanagedObj)
   at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
   at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
   at Microsoft.Phone.Controls.Pivot.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
   at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
   at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
   at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
   at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
   at Microsoft.Phone.Controls.PhoneApplicationFrame.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)

EDIT 3:

According to Stack Trace it seems to be caused by some error in visualizing first page. But according to my analysis :) it seems to be caused by error in getting error from server.

APP Info:

My application provides info about books from library. Sometimes when app is starting and it tries to update book ratings, app will crash. Application crashes before getting response. I use RestSharp Library for sending HTTP requests.

War es hilfreich?

Lösung

Ok. It seems that the problem was the same like in this question:

UnhandledException in WP7

If you have the same problem, please vote here: http://connect.microsoft.com/VisualStudio/feedback/details/731082/windows-phone-forum-when-adding-multi-usercontrol-with-x-name-attribute-to-visualtree-exception-the-parameter-is-incorrect-is-thrown

Many thanks to KooKiz for show me way how to see stack trace of exception :). It helps me to find solution of my problem.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top