Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ItemGroup>
<!-- Product dependencies netstandard -->
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.9" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="18.7.23" />
<PackageVersion Include="Microsoft.Extensions.ExtraAnalyzers" Version="8.0.0-rc.2.23510.2" />
<PackageVersion Include="System.Text.Json" Version="10.0.8" />
<!-- Product dependencies shared -->
Expand Down
2 changes: 2 additions & 0 deletions src/A2A.AspNetCore/A2AHttpProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ public async Task ExecuteAsync(HttpContext httpContext)
{
await foreach (var taskEvent in _events.WithCancellation(httpContext.RequestAborted))
{
#pragma warning disable VSTHRD103 // Serialize to string is not blocking I/O
var json = JsonSerializer.Serialize(taskEvent,
A2AJsonUtilities.DefaultOptions.GetTypeInfo(typeof(StreamResponse)));
#pragma warning restore VSTHRD103
await httpContext.Response.BodyWriter.WriteAsync(
Encoding.UTF8.GetBytes($"data: {json}\n\n"), httpContext.RequestAborted);
await httpContext.Response.BodyWriter.FlushAsync(httpContext.RequestAborted);
Expand Down
2 changes: 2 additions & 0 deletions src/A2A.AspNetCore/JsonRpcStreamedResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ await SseFormatter.WriteAsync(
? JsonRpcResponse.CreateJsonRpcErrorResponse(_requestId, a2aEx)
: JsonRpcResponse.InternalErrorResponse(
_requestId, "An internal error occurred during streaming.");
#pragma warning disable VSTHRD103 // Serialize to string is not blocking I/O
var errorJson = JsonSerializer.Serialize(errorResponse, responseTypeInfo);
#pragma warning restore VSTHRD103
var errorBytes = Encoding.UTF8.GetBytes($"data: {errorJson}\n\n");
await httpContext.Response.Body.WriteAsync(errorBytes, httpContext.RequestAborted);
await httpContext.Response.Body.FlushAsync(httpContext.RequestAborted);
Expand Down
Loading