-
Notifications
You must be signed in to change notification settings - Fork 876
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 and Native AOT approach #2146
Open
3 of 8 tasks
Comments
Hello, not sure if it will help but I managed to make it work on windows aot by changing only one line private static void LoadNetStandardDelegates(string userSpecifiedPath)
{
if (userSpecifiedPath != null)
{
if (WindowsNative.LoadLibraryEx(userSpecifiedPath, IntPtr.Zero, WindowsNative.LoadLibraryFlags.LOAD_WITH_ALTERED_SEARCH_PATH) == IntPtr.Zero)
{
// TODO: The Win32Exception class is not available in .NET Standard, which is the easy way to get the message string corresponding to
// a win32 error. FormatMessage is not straightforward to p/invoke, so leaving this as a job for another day.
throw new InvalidOperationException($"Failed to load librdkafka at location '{userSpecifiedPath}'. Win32 error: {Marshal.GetLastWin32Error()}");
}
}
- TrySetDelegates(new List<Type> { typeof(NativeMethods.NativeMethods) });
+ SetDelegates(typeof(NativeMethods.NativeMethods));
} |
Having the same issue here (Publishing as trimmed, no AOT). |
Any updates from the team on this? |
Any updates on this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
If I publish my code in Native AOT then all parts of code which are related to Kafka usage (such as: Producers and Consumers) stopped working. I have got the next message in Console after running published to native AOT app
I'm using a very simple code which works in regular published app:
OS -> Windows 11
Nuget package is the latest one on the current moment
Confluent.Kafka, Version=2.3.0.0, Culture=neutral, PublicKeyToken=12c514ca49093d1e
How to reproduce
dotnet publish -c Release -o "otput_path_where_app_will_be_published"
Checklist
Please provide the following information:
The text was updated successfully, but these errors were encountered: