Skip to content

Commit 90d47aa

Browse files
imran-siddiquegithub-code-quality[bot]
authored andcommitted
Potential fix for pull request finding 'Generic catch clause'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Signed-off-by: Imran Siddique <imran.siddique@microsoft.com>
1 parent 6eb814f commit 90d47aa

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

agent-governance-dotnet/examples/AspNetMiddleware/GovernanceCheckMiddleware.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,15 @@ public async Task InvokeAsync(HttpContext context)
8181
{
8282
result = _kernel.EvaluateToolCall(agentId, toolName, args);
8383
}
84-
catch (Exception ex)
84+
catch (Exception ex) when (
85+
ex is not OutOfMemoryException &&
86+
ex is not StackOverflowException &&
87+
ex is not AccessViolationException &&
88+
ex is not AppDomainUnloadedException &&
89+
ex is not BadImageFormatException &&
90+
ex is not CannotUnloadAppDomainException &&
91+
ex is not InvalidProgramException &&
92+
ex is not System.Threading.ThreadAbortException)
8593
{
8694
// Fail-closed on evaluation errors: do not let an unexpected
8795
// exception silently allow a request through.

0 commit comments

Comments
 (0)