.NET 8 support issue
Application Details
- Target Framework: .NET 8
- Previous Framework: .NET 6
The application is an ASP.NET Core web API that uses the MonoMod.Common library and the Softwarehelden.Transactions.Oletx library to patch the OleTx implementation in System.Transactions and the System.Data.SqlClient library for supporting distributed transactions with MSSQL and Oracle servers.
Steps to Reproduce
- Update the project's target framework from .NET 6 to .NET 8.
- Build and run the application.
- The
System.NullReferenceExceptionis thrown during the application startup.
Expected Behavior
The application should start successfully and run without any exceptions when targeting .NET 8.
Additional Information
- I have already tried updating to the latest versions of the
MonoMod.CommonandSoftwarehelden.Transactions.Oletxlibraries, but the issue persists. - I have also reviewed the documentation and release notes for these libraries, but there are no known issues or compatibility concerns mentioned for .NET 8.
Any assistance or guidance in resolving this issue would be greatly appreciated. Please let me know if you need any additional information or if you have any suggestions on how to proceed.
As mentioned on the main MonoMod repo in other issues, MonoMod was recently rewritten and the what was MonoMod.Common is now (roughly, the actual API has essentially completely changed) MonoMod.Core, with included support for net7 and net8. See https://github.com/MonoMod/MonoMod/issues/94
As a side note, I would recommend changing to use MonoMod.RuntimeDetour instead of trying to use Core directly.
How can I accomplish the same thing, like this: OletxPatcher.Patch(); MsSqlPatcher.Patch(typeof(SqlConnection).Assembly);, using the new MonoMod.Core library?
public static async Task<ExitCode> RunApplicationAsync(string[] args) { try { OletxPatcher.Patch(); MsSqlPatcher.Patch(typeof(SqlConnection).Assembly);
Console.WriteLine("Configuring...");
var app = CreateWebApplicationBuilder(args).Build();
app.ConfigureApplicationPipeline();
Console.WriteLine("Running");
await app.RunAsync();
return ExitCode.Success;
}
catch (TaskCanceledException)
{
return ExitCode.Success;
}
catch (Exception ex)
{
await Console.Error.WriteLineAsync($"Fatal error starting application. {ex}");
return ExitCode.GeneralFailure;
}
finally
{
await Log.CloseAndFlushAsync();
}
}