Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk committed Jun 19, 2023
1 parent 66402e2 commit 0893253
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Polly.Core/Utils/ObjectPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal sealed class ObjectPool<T>
private int _numItems;

public ObjectPool(Func<T> createFunc, Action<T> reset)
: this(createFunc, o => { reset(o); return true; })
: this(createFunc, o => { reset(o); return true; })
{
}

Expand Down
9 changes: 8 additions & 1 deletion test/Polly.TestUtils/TestUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ private sealed class CallbackDiagnosticSource : DiagnosticSource

public override bool IsEnabled(string name) => true;

public override void Write(string name, object? value) => _callback((TelemetryEventArguments)value!);
public override void Write(string name, object? value)
{
var args = (TelemetryEventArguments)value!;

// copy the args because these are pooled and in tests we want to preserve them
args = TelemetryEventArguments.Get(args.Source, args.EventName, args.Context, args.Outcome, args.Arguments);
_callback(args);
}
}
}

0 comments on commit 0893253

Please sign in to comment.