refactor(platforms): modernize aspnetcore tfms and deps#348
refactor(platforms): modernize aspnetcore tfms and deps#348
Conversation
There was a problem hiding this comment.
Pull request overview
Modernizes Exceptionless platform integrations and the test stack to align with newer .NET TFMs and updated dependency versions, while expanding ASP.NET Core hosting/diagnostics coverage.
Changes:
- Upgrades test infrastructure to xUnit v3 and updates test project TFMs/dependencies.
- Updates ASP.NET Core integration to multi-target newer TFMs, replaces DiagnosticAdapter usage, and adds exception de-duplication + handled-exception capture.
- Updates various platform/sample dependencies (MessagePack, NLog, log4net, AWS Lambda, MVC sample packages, etc.).
Reviewed changes
Copilot reviewed 58 out of 60 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/Exceptionless.Tests/Utility/TestOutputWriter.cs | Aligns test output helper usage with updated xUnit package set. |
| test/Exceptionless.Tests/Storage/IsolatedStorageFileStorageTests.cs | Removes xUnit abstractions import as part of test stack migration. |
| test/Exceptionless.Tests/Storage/InMemoryFileStorageTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Storage/FolderFileStorageTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Storage/FileStorageTestsBase.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Serializer/JsonSerializerTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/PluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/PluginTestBase.cs | Updates imports as part of xUnit v3 migration. |
| test/Exceptionless.Tests/Plugins/910_DuplicateCheckerPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/900_CancelSessionsWithNoUserPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/110_IgnoreUserAgentPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/050_EnvironmentInfoPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/040_ReferenceIdPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/020_ErrorPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/016_SetEnvironmentUserPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/015_ConfigurationDefaultsPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/010_EventExclusionPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Plugins/005_HandleAggregateExceptionsPluginTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Platforms/HostingExtensionsTests.cs | Adds tests for new host builder/HostApplicationBuilder extension methods. |
| test/Exceptionless.Tests/Platforms/AspNetCoreRequestInfoTests.cs | Gates ASP.NET Core request tests to newer TFM and retains “no POST read for handled” assertions. |
| test/Exceptionless.Tests/Platforms/AspNetCoreExceptionCaptureTests.cs | Adds tests for handled/unhandled exception capture and de-duplication across middleware/diagnostics. |
| test/Exceptionless.Tests/ExceptionlessClientTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Exceptionless.Tests.csproj | Updates TFMs, upgrades test dependencies, and conditionally references ASP.NET Core platform project. |
| test/Exceptionless.Tests/EventBuilderTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.Tests/Configuration/ConfigurationTests.cs | Removes unused xUnit abstractions import. |
| test/Exceptionless.TestHarness/Exceptionless.TestHarness.csproj | Updates TFMs and adjusts packages to support xUnit v3 assertions and newer dependency versions. |
| test/Exceptionless.MessagePack.Tests/Exceptionless.MessagePack.Tests.csproj | Updates TFMs and migrates test dependencies to xUnit v3. |
| src/Platforms/Exceptionless.WebApi/RequestInfoCollector.cs | Whitespace-only formatting cleanup. |
| src/Platforms/Exceptionless.Web/RequestInfoCollector.cs | Whitespace-only formatting cleanup. |
| src/Platforms/Exceptionless.NLog/ExceptionlessTarget.cs | Adds explicit validation for configured fields during target initialization. |
| src/Platforms/Exceptionless.NLog/ExceptionlessField.cs | Removes RequiredParameter attributes in favor of runtime validation in target init. |
| src/Platforms/Exceptionless.NLog/Exceptionless.NLog.csproj | Upgrades NLog dependency. |
| src/Platforms/Exceptionless.MessagePack/PersistedDictionaryFormatter.cs | Adds parameterless ctor to support formatter activation with default resolver. |
| src/Platforms/Exceptionless.MessagePack/Exceptionless.MessagePack.csproj | Upgrades MessagePack dependency to v3.x. |
| src/Platforms/Exceptionless.MessagePack/DataDictionaryFormatter.cs | Makes formatter nullable-aware to handle nil values cleanly. |
| src/Platforms/Exceptionless.Log4net/Exceptionless.Log4net.csproj | Upgrades log4net dependency. |
| src/Platforms/Exceptionless.Extensions.Logging/Exceptionless.Extensions.Logging.csproj | Multi-targets newer .NET versions and aligns Microsoft.Extensions.Logging package versions per TFM. |
| src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessLifetimeService.cs | Moves to lifecycle-based hosting interface to hook start/stop phases. |
| src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessExtensions.cs | Adds HostApplicationBuilder overloads and centralizes lifetime service registration. |
| src/Platforms/Exceptionless.Extensions.Hosting/Exceptionless.Extensions.Hosting.csproj | Multi-targets newer .NET versions and aligns hosting abstractions versions per TFM. |
| src/Platforms/Exceptionless.AspNetCore/RequestInfoCollector.cs | Removes unsupported header name exclusions and minor formatting cleanup. |
| src/Platforms/Exceptionless.AspNetCore/ExceptionlessMiddleware.cs | Adds handled-exception capture via ExceptionHandlerFeature and de-duplication hook. |
| src/Platforms/Exceptionless.AspNetCore/ExceptionlessExtensions.cs | Replaces DiagnosticAdapter subscription with direct DiagnosticListener subscription. |
| src/Platforms/Exceptionless.AspNetCore/ExceptionlessDiagnosticListener.cs | Reworks listener to IObserver-based handling and adds de-duplication support. |
| src/Platforms/Exceptionless.AspNetCore/Exceptionless.AspNetCore.csproj | Multi-targets newer .NET and switches to ASP.NET Core shared framework reference. |
| src/Platforms/Exceptionless.AspNetCore/ExceptionCaptureState.cs | Adds per-request de-duplication state to prevent double-submission. |
| src/Exceptionless/Exceptionless.csproj | Updates dependency versions for newer stack alignment. |
| samples/Exceptionless.SampleWpf/Exceptionless.SampleWpf.csproj | Updates sample Windows desktop TFM. |
| samples/Exceptionless.SampleWindows/Exceptionless.SampleWindows.csproj | Updates sample Windows desktop TFM. |
| samples/Exceptionless.SampleWebApi/Exceptionless.SampleWebApi.csproj | Updates OWIN and Newtonsoft.Json package versions. |
| samples/Exceptionless.SampleMvc/packages.config | Updates MVC sample client-side and System.* package versions. |
| samples/Exceptionless.SampleMvc/Exceptionless.SampleMvc.csproj | Updates assembly hint paths to match updated packages.config versions. |
| samples/Exceptionless.SampleLambdaAspNetCore/Exceptionless.SampleLambdaAspNetCore.csproj | Updates TFM and AWS Lambda ASP.NET Core server dependencies. |
| samples/Exceptionless.SampleLambda/Exceptionless.SampleLambda.csproj | Updates TFM and AWS Lambda dependencies. |
| samples/Exceptionless.SampleHosting/Program.cs | Updates comments to reflect revised hosting integration behavior. |
| samples/Exceptionless.SampleHosting/Exceptionless.SampleHosting.csproj | Updates sample hosting app TFM. |
| samples/Exceptionless.SampleConsole/Exceptionless.SampleConsole.csproj | Updates TFM and Exceptionless sample dependency versions. |
| samples/Exceptionless.SampleBlazorWebAssemblyApp/Exceptionless.SampleBlazorWebAssemblyApp.csproj | Updates TFM and Blazor WebAssembly package versions. |
| samples/Exceptionless.SampleAspNetCore/Exceptionless.SampleAspNetCore.csproj | Updates sample ASP.NET Core app TFM. |
| build/common.props | Updates license expression casing and upgrades build tooling packages (SourceLink/AsyncFixer/MinVer). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
chore: modernize platform integrations and test stack chore: audit sample deps and dogfood apps
92a2940 to
4682aea
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 59 out of 61 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Platforms/Exceptionless.AspNetCore/ExceptionlessExtensions.cs
Outdated
Show resolved
Hide resolved
src/Platforms/Exceptionless.AspNetCore/ExceptionlessDiagnosticListener.cs
Show resolved
Hide resolved
src/Platforms/Exceptionless.Extensions.Logging/ExceptionlessLoggerExtensions.cs
Show resolved
Hide resolved
src/Platforms/Exceptionless.AspNetCore/ExceptionlessExtensions.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 67 out of 69 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessExtensions.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 67 out of 69 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/Platforms/Exceptionless.AspNetCore/ExceptionlessExtensions.cs:54
UseExceptionless(IApplicationBuilder)registers anApplicationStoppingcallback that blocks synchronously onProcessQueueAsync()viaGetResult(). With the newExceptionlessLifetimeService(registered by the hostingAdd/UseExceptionlessextensions), this can lead to duplicate flushes and increases the risk of shutdown hangs. Consider skipping this registration whenExceptionlessLifetimeServiceis present, and/or avoid sync-over-async by delegating shutdown flushing entirely to the hosted lifecycle service.
var diagnosticListener = app.ApplicationServices.GetRequiredService<DiagnosticListener>();
diagnosticListener?.Subscribe(
new ExceptionlessDiagnosticListener(client),
eventName => ExceptionlessDiagnosticListener.IsRelevantEvent(eventName));
var lifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>();
lifetime.ApplicationStopping.Register(() => client.ProcessQueueAsync().ConfigureAwait(false).GetAwaiter().GetResult());
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessLifetimeService.cs
Show resolved
Hide resolved
| public ValueTask<bool> TryHandleAsync(HttpContext httpContext, Exception exception, CancellationToken cancellationToken) { | ||
| if (cancellationToken.IsCancellationRequested) | ||
| return ValueTask.FromResult(false); | ||
|
|
||
| var contextData = new ContextData(); | ||
| contextData.MarkAsUnhandledError(); | ||
| contextData.SetSubmissionMethod(nameof(ExceptionlessExceptionHandler)); | ||
|
|
||
| exception.ToExceptionless(contextData, _client).SetHttpContext(httpContext).Submit(); | ||
|
|
||
| return ValueTask.FromResult(false); |
There was a problem hiding this comment.
With the new ASP.NET Core setup, the same request exception can be captured by multiple paths (e.g., ExceptionlessExceptionHandler via UseExceptionHandler() and ExceptionlessDiagnosticListener via DiagnosticSource events). TryHandleAsync always submits without checking whether the exception was already reported for this request, which can lead to duplicate events. Consider adding a per-request de-dup marker (e.g., in HttpContext.Items) keyed on the exception instance/submission method, and have all capture paths consult/set it before submitting.
src/Platforms/Exceptionless.Extensions.Hosting/ExceptionlessExtensions.cs
Outdated
Show resolved
Hide resolved
| /// <summary> | ||
| /// Adds the Exceptionless middleware for capturing unhandled exceptions and ensures that the Exceptionless pending queue is processed before the host shuts down. | ||
| /// Registers the Exceptionless <see cref="IExceptionHandler"/> and required ASP.NET Core services | ||
| /// for capturing unhandled exceptions. Call this in your service configuration alongside <c>app.UseExceptionHandler()</c>. | ||
| /// </summary> | ||
| public static IServiceCollection AddExceptionless(this IServiceCollection services) { | ||
| services.AddHttpContextAccessor(); | ||
| if (!services.Any(descriptor => | ||
| descriptor.ServiceType == typeof(IExceptionHandler) && | ||
| descriptor.ImplementationType == typeof(ExceptionlessExceptionHandler))) | ||
| services.AddExceptionHandler<ExceptionlessExceptionHandler>(); | ||
| return services; | ||
| } |
There was a problem hiding this comment.
The new IServiceCollection AddExceptionless() overload in the ASP.NET Core package will be chosen over the existing hosting/DI overload AddExceptionless(this IServiceCollection, Action<ExceptionlessConfiguration> configure = null) whenever callers write services.AddExceptionless() with no args. That silently changes behavior from “register/configure ExceptionlessClient” to “register ASP.NET Core exception handling services”, which is a high-risk breaking change (and can leave ExceptionlessClient unregistered in DI). Consider renaming this ASP.NET Core-specific method (e.g., AddExceptionlessAspNetCore() / AddExceptionlessExceptionHandler()), or making the client-registration overload non-optional so the call sites can’t silently bind to the wrong method.
…tensions.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Modernizes Exceptionless platform integrations and the test stack to align with newer .NET TFMs and updated dependency versions, while expanding ASP.NET Core hosting/diagnostics coverage.
Changes: