Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 8 support issue #41

Open
menaTitan opened this issue Mar 13, 2024 · 3 comments
Open

.NET 8 support issue #41

menaTitan opened this issue Mar 13, 2024 · 3 comments

Comments

@menaTitan
Copy link

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

  1. Update the project's target framework from .NET 6 to .NET 8.
  2. Build and run the application.
  3. The System.NullReferenceException is 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.Common and Softwarehelden.Transactions.Oletx libraries, 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.

@Windows10CE
Copy link

Windows10CE commented Mar 13, 2024

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 MonoMod/MonoMod#94

@Windows10CE
Copy link

As a side note, I would recommend changing to use MonoMod.RuntimeDetour instead of trying to use Core directly.

@menaTitan
Copy link
Author

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 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();
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants