Skip to content

Commit c7c3d76

Browse files
Fix IsOfflineException to Handle new MAUI type for integers on iOS (#42)
1 parent b7e00df commit c7c3d76

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Float.Core/Extensions/Exception.extensions.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,18 @@ public static bool IsOfflineException(this Exception e)
5656

5757
if (code != null)
5858
{
59-
switch (Convert.ToInt64(code, new NumberFormatInfo()))
59+
long convertedCode;
60+
61+
try
62+
{
63+
convertedCode = Convert.ToInt64(code, new NumberFormatInfo());
64+
}
65+
catch (InvalidCastException) when (code is nint parsedCode)
66+
{
67+
convertedCode = long.Parse(parsedCode.ToString());
68+
}
69+
70+
switch (convertedCode)
6071
{
6172
// CannotFindHost
6273
// CannotConnectToHost

0 commit comments

Comments
 (0)