Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

[Bug] UWP - System.Exception: Catastrophic failure :) in Xamarin.Essentials.Connectivity

Open cosminstirbu opened this issue 6 years ago • 8 comments

Description

Xamarin.Essentials.Connectivity causes this exception on UWP:

Incident Identifier: a13d2f06-d723-4671-a2c4-cc904fd5401c
CrashReporter Key:   1ef06cf4-f25b-438e-9c7a-948098e9fd3a
Hardware Model:      Surface 3
Process:         MyApp.UWP.exe [15968]
Identifier:      MyApp
Version:         2.4.1116.0 (2.4.1116.0)

Date/Time:       2020-02-03T11:02:33.388923Z
OS Version:      10.0.17763 (10.0.17763.973)

Exception Type:  System.Exception

Application Specific Information:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF)

Last Exception Backtrace:
0   System.Runtime.InteropServices       0x7ffdf7e6ed31   System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32 hr, RuntimeTypeHandle typeHnd) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.Interop\src\Shared\McgMarshal.cs at 1189:13
1   __Interop                            0x7ffddc6edb8e   __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, Void*) + 0xbe
2   ???                                  0x7ffddc6edbe7   __Interop.ForwardComStubs.Stub_3[TThis, TResult](__ComObject, Int32) + 0x37
3   Windows.Networking.Connectivity      0x7ffddcda8f88   Windows.Networking.Connectivity.ConnectionProfile.get_NetworkAdapter() + 0x18
4   Xamarin.Essentials.Connectivity      0x7ffdddbadb40   Xamarin.Essentials.Connectivity.<get_PlatformConnectionProfiles>d__22.MoveNext() + 0x220
5   System.Linq.Enumerable               0x7ffddd015cd5   System.Linq.Enumerable.DistinctIterator`1.MoveNext() + 0x95
6   System.Collections.Generic           0x7ffddcde3bc9   System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1) + 0x49
7   System.Collections.Generic.List`1    0x7ffddcde44dc   System.Collections.Generic.List`1..ctor(IEnumerable`1) + 0xdc
8   Xamarin.Essentials                   0x7ffddd521a46   Xamarin.Essentials.Connectivity.SetCurrent() + 0x66
9   Xamarin.Essentials                   0x7ffddd52193c   Xamarin.Essentials.Connectivity.OnConnectivityChanged(ConnectivityChangedEventArgs) + 0x5c
10  Xamarin.Essentials                   0x7ffddd5218d4   Xamarin.Essentials.Connectivity.OnConnectivityChanged() + 0x74
11  Xamarin.Essentials                   0x7ffddd521858   Xamarin.Essentials.Connectivity.NetworkStatusChanged(Object) + 0x8
12  SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods0x7ffddcc31c21   SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.callback_agg_function_final.InvokeOpenStaticThunk(IntPtr) + 0x21
13  Syncfusion.Pdf.Parsing.PdfLoadedField0x7ffddcb2a288   Syncfusion.Pdf.Parsing.PdfLoadedField.BeforeNameChangesEventHandler.Invoke(String) + 0x28
14  ???                                  0x7ffddcd5c823   MyApp.UWP!<BaseAddress>+0x24bc823
15  System.Runtime.InteropServices       0x7ffdf7e6ed31   System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32 hr, RuntimeTypeHandle typeHnd) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.Interop\src\Shared\McgMarshal.cs at 1189:13
16  __Interop                            0x7ffddc6eda78   __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32) + 0xb8
17  __Interop                            0x7ffddc6ed9b4   __Interop.ForwardComStubs.Stub_19[TThis](__ComObject, Int32) + 0x24
18  Microsoft.AppCenter.Utils            0x7ffddcc9d77d   Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x3d

Binary Images:
0x00007ffdf7570000 -        0x00007ffdf823d000  SharedLibrary unknown  <0f1e70b9093f4295bc52d5790c654d7c> SharedLibrary.pdb
0x00007ffdda8a0000 -        0x00007ffdde122000 +MyApp.UWP unknown  <93378b1b81dc464a94dceb4e6e1ba1c7> MyApp.UWP.pdb

Steps to Reproduce

Don't have any :(

Expected Behavior

Shouldn't crash

Actual Behavior

App crashes

Basic Information

  • Version with issue: 1.3.1
  • Last known good version: Unknown
  • Platform Target Frameworks:
    • UWP: 10.0.16299.0
  • Affected Devices: Surface 3, Surface Go, Surface Pro 4, Surface Pro - running Windows 10.0.17763, 10.0.17134

cosminstirbu avatar Feb 03 '20 15:02 cosminstirbu

Does this happen with every network change? How are you using the code?

jamesmontemagno avatar Feb 07 '20 21:02 jamesmontemagno

Unfortunately I haven't been able to reproduce it myself so I'm not sure when it happens.

I'm just registering an event to Connectivity.ConnectivityChanged, I don't interact with the Connectivity feature in any other way.

cosminstirbu avatar Feb 09 '20 17:02 cosminstirbu

Gotcha, i put in a bunch of extra exception handling in my PR so, we can just track that once it is in :)

jamesmontemagno avatar Feb 09 '20 19:02 jamesmontemagno

#1088 may fix this or at least provide some more insight. Please report back once it's released in a nuget update with more info.

Redth avatar Feb 19 '20 02:02 Redth

After updating to Xamarin.Essentials 1.4.0 (which includes the fix for this issue) the crash continues to reproduce with the exact same stacktrace - which doesn't make any bit of sense, I've reviewed the PR myself, the exception should be handled.

I have doubled check that we did actually update to 1.4.0 and that's definitely the case.

My only guess is that maybe AppCenter Crashes SDK (3.0.0) has some sort of bug which causes it to report a misleading stacktrace.

Interestingly enough, I can't understand why there's a Syncfusion call lower down the stacktrace that seems to trigger this Syncfusion.Pdf.Parsing.PdfLoadedField.BeforeNameChangesEventHandler.Invoke(String) ...

It doesn't reproduce that often so it's not that worrying, but still. I'll continue to monitor it and if I have some more insight I'll get back to you.

cosminstirbu avatar Mar 02 '20 07:03 cosminstirbu

Do you have the chunk of code that seems to be crashing?

jamesmontemagno avatar Mar 03 '20 18:03 jamesmontemagno

I don't, but I'm assuming that line Syncfusion.Pdf.Parsing.PdfLoadedField.BeforeNameChangesEventHandler.Invoke(String) is from one of these two nuget packages Syncfusion.SfPdfViewer.UWP and Syncfusion.Xamarin.Pdf

cosminstirbu avatar Mar 04 '20 08:03 cosminstirbu

This might not pertain to your particular issue but on deployment of our Windows WPF application our clients reported a Catastrophic Failure on one of their laptops. On investigation the stack trace lead to the same error (Windows.Networking.Connectivity.ConnectionProfile.get_NetworkAdapter())

I will fill this comment with more details but at this point it seems they were messing with their adapters trying to fix the deployment issues. So far wrapping it in try/catch might be the only solution I see.

EDIT: 30/01/2023 We have updated all we could and this issue keeps happening with different customers. This function seems to be unstable on some machines. Trying to figure out how to handle it properly or maybe use alternatives.

BorderKeeper avatar Jun 15 '21 10:06 BorderKeeper