Skip to content

Commit

Permalink
fix: Make sure that if TSInteropMarshaller.Allocate fails, we get the…
Browse files Browse the repository at this point in the history
… right exception
  • Loading branch information
dr1rrb committed Sep 16, 2021
1 parent 0dfd158 commit ba663c0
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ public static HandleRef<T> Allocate<T>(string propertySetterName, string? proper
}
catch (Exception e)
{
value.Dispose();
try
{
value.Dispose();
}
// If the allocation failed, the dispose will most likely also fail,
// but we want to propagate the real exception of the allocation!
catch (Exception) { }

if (_logger.Value.IsEnabled(LogLevel.Error))
{
Expand Down

0 comments on commit ba663c0

Please sign in to comment.