Skip to content

Commit

Permalink
Merge pull request #773 from rruizGit/dev/rruiz/pr772
Browse files Browse the repository at this point in the history
Handle FileNotFoundException thrown while deserializing exceptions
  • Loading branch information
AArnott authored Mar 3, 2022
2 parents 99d5c32 + 81b738e commit 190520a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/StreamJsonRpc/JsonRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ internal void AddLocalRpcMethod(MethodInfo handler, object? target, JsonRpcMetho
{
typeDeclaringAssembly = Assembly.Load(assemblyName);
}
catch (FileLoadException)
catch (Exception ex) when (ex is FileNotFoundException or FileLoadException)
{
// Try removing the version from the AssemblyName and try again, in case the message came from a newer version.
var an = new AssemblyName(assemblyName);
Expand All @@ -1230,7 +1230,7 @@ internal void AddLocalRpcMethod(MethodInfo handler, object? target, JsonRpcMetho
{
typeDeclaringAssembly = Assembly.Load(an.FullName);
}
catch (FileLoadException)
catch (Exception exRedux) when (exRedux is FileNotFoundException or FileLoadException)
{
// If we fail again, we'll just try to load the exception type from the AppDomain without an assembly's context.
}
Expand Down

0 comments on commit 190520a

Please sign in to comment.