Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates request-info collection across the ASP.NET Core / ASP.NET (System.Web) / WebApi platform integrations to avoid reading POST bodies for handled errors, and modernizes build configuration to use the SDK from global.json.
Changes:
- Gate POST body/form collection behind an
isUnhandledErrorflag in Web + ASP.NET Core request collectors and propagate that flag from platform plugins. - Add ASP.NET Core request-info unit tests and add the ASP.NET Core platform dependency to the test project.
- Update build tooling: bump
global.jsonSDK, tweak common props, and refresh GitHub Actions workflow steps.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Exceptionless.Tests/Platforms/AspNetCoreRequestInfoTests.cs | Adds coverage for ASP.NET Core request body behavior with handled vs unhandled errors. |
| test/Exceptionless.Tests/Exceptionless.Tests.csproj | Adds AspNetCore platform reference + ASP.NET Core Http package for tests. |
| src/Platforms/Exceptionless.WebApi/RequestInfoCollector.cs | Adds isUnhandledError parameter (POST collection still not implemented). |
| src/Platforms/Exceptionless.WebApi/ExceptionlessWebApiPlugin.cs | Passes IsUnhandledError when collecting request info. |
| src/Platforms/Exceptionless.WebApi/ExceptionlessWebApiExtensions.cs | Updates WebApi GetRequestInfo API to accept isUnhandledError. |
| src/Platforms/Exceptionless.Web/RequestInfoCollector.cs | Gates POST data collection behind isUnhandledError and reorders form/body logic. |
| src/Platforms/Exceptionless.Web/ExceptionlessWebPlugin.cs | Passes IsUnhandledError when collecting request info. |
| src/Platforms/Exceptionless.Web/ExceptionlessWebExtensions.cs | Updates Web GetRequestInfo APIs to accept isUnhandledError. |
| src/Platforms/Exceptionless.AspNetCore/RequestInfoCollector.cs | Gates POST data collection behind isUnhandledError and reorders form/body logic. |
| src/Platforms/Exceptionless.AspNetCore/ExceptionlessExtensions.cs | Updates AspNetCore GetRequestInfo API to accept isUnhandledError. |
| src/Platforms/Exceptionless.AspNetCore/ExceptionlessAspNetCorePlugin.cs | Passes IsUnhandledError when collecting request info. |
| samples/Exceptionless.SampleAspNetCore/Controllers/ValuesController.cs | Minor formatting changes around catch blocks. |
| global.json | Updates the pinned .NET SDK version. |
| build/common.props | Enables Windows targeting in the build properties. |
| .github/workflows/build-windows.yml | Updates workflow env + .NET setup to use global.json. |
| .github/workflows/build-osx.yml | Updates workflow env + .NET setup to use global.json. |
| .github/workflows/build-linux.yml | Updates workflow env + .NET setup to use global.json. |
Comments suppressed due to low confidence (2)
src/Platforms/Exceptionless.AspNetCore/RequestInfoCollector.cs:69
ContentLength.GetValueOrDefault()treats a missing Content-Length header as 0, and since thecontentLength == 0branch returns early this will report an empty post and skip reading the body (or form) for chunked requests / unknown-length bodies. Consider handlingContentLength == nullseparately (e.g., read up toMAX_BODY_SIZE), and/or checkHasFormContentTypebefore thecontentLength == 0early-return.
long contentLength = context.Request.ContentLength.GetValueOrDefault();
if(contentLength == 0) {
string message = "Content-length was zero, empty post.";
log.Debug(message);
return message;
}
src/Platforms/Exceptionless.Web/RequestInfoCollector.cs:82
- The
contentLength == 0early-return now happens before checkingRequest.Form. IfContentLengthis 0/unknown but form fields are available, this will incorrectly report an empty post and skip collecting the form. Consider checkingRequest.Form.Countbefore thecontentLength == 0guard, or treating 0 as “unknown length” and falling back to a bounded read (MAX_BODY_SIZE).
int contentLength = context.Request.ContentLength;
if (contentLength == 0) {
string message = "Content-length was zero, empty post.";
log.Debug(message);
return message;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Restores the request body stream position after accessing form data in AspNetCore and Web platforms. This commit also updates the test project to target .NET 10 and migrates the copyright notice to use a dynamic year.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <EnableWindowsTargeting>true</EnableWindowsTargeting> | ||
|
|
||
| <Copyright>Copyright (c) 2025 Exceptionless. All rights reserved.</Copyright> | ||
| <Copyright>Copyright © $([System.DateTime]::Now.ToString(yyyy)) Exceptionless. All rights reserved.</Copyright> |
There was a problem hiding this comment.
The MSBuild property function call uses Now.ToString(yyyy) without quoting the format string. MSBuild property functions typically require string arguments to be quoted (e.g., ToString('yyyy')), otherwise the argument may be treated as an empty/unresolved expression and not yield the intended year.
| <Copyright>Copyright © $([System.DateTime]::Now.ToString(yyyy)) Exceptionless. All rights reserved.</Copyright> | |
| <Copyright>Copyright © $([System.DateTime]::Now.ToString('yyyy')) Exceptionless. All rights reserved.</Copyright> |
This PR updates request-info collection across the ASP.NET Core / ASP.NET (System.Web) / WebApi platform integrations to avoid reading POST bodies for handled errors, and modernizes build configuration to use the SDK from global.json.
Changes: