Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Microsoft.Data.Sqlite.Core/SqliteConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ static SqliteConnection()
{
currentAppData = appDataType?.GetRuntimeProperty("Current")?.GetValue(null);
}
catch (TargetInvocationException)
catch (TargetInvocationException ex) when (IsNoPackageIdentityException(ex.InnerException))
{
}
catch (InvalidOperationException ex) when (IsNoPackageIdentityException(ex))
{
Comment thread
AndriySvyryd marked this conversation as resolved.
// Ignore "The process has no package identity."
}
Comment thread
AndriySvyryd marked this conversation as resolved.
Outdated

if (currentAppData != null)
Expand All @@ -104,6 +106,11 @@ static SqliteConnection()
}
}

private static bool IsNoPackageIdentityException(Exception? ex)
=> ex is InvalidOperationException or COMException
Comment thread
AndriySvyryd marked this conversation as resolved.
Outdated
&& (ex.HResult == unchecked((int)0x80073D54) // APPMODEL_ERROR_NO_PACKAGE
|| ex.HResult == unchecked((int)0x8000000D)); // E_ILLEGAL_STATE_CHANGE

/// <summary>
/// Initializes a new instance of the <see cref="SqliteConnection" /> class.
/// </summary>
Expand Down
Loading