java.interop icon indicating copy to clipboard operation
java.interop copied to clipboard

Fix known issues with NativeAOT

Open jonathanpeppers opened this issue 2 years ago • 2 comments

Related: https://github.com/xamarin/java.interop/issues/1157

When setting $(EnableAotAnalyzer) to true, there are several warnings we will suppress for now. These will likely work under Mono, but will need to be fixed one day in .NET 10 or some future release that supports NativeAOT.

Ignoring AOT warnings like a reasonable place to start, so we can enable the analyzer and not introduce new warnings.

Creating an issue for now, so I can link to this issue from C# code comments.


Requires fixing, at minimum:

  • [x] https://github.com/dotnet/java-interop/issues/1258
  • [x] https://github.com/dotnet/java-interop/issues/1262
  • [ ] https://github.com/dotnet/java-interop/issues/1263

jonathanpeppers avatar Feb 13 '24 18:02 jonathanpeppers

Related comment:

  • https://github.com/xamarin/java.interop/pull/1190/files/33bd50195eec18640d8f1c86692abd07e5b68e93..4522d35c7ffb55456db2cd10466946fb504f84b8#r1504263415

jonathanpeppers avatar Feb 27 '24 14:02 jonathanpeppers

Update

We'll probably actually suppress the warnings like:

// FIXME: https://github.com/xamarin/xamarin-android/issues/8724
// IL3050 disabled in source: if someone uses NativeAOT, they will get the warning.
#pragma warning disable IL3050
var dynamic = new DynamicMethod (DynamicMethodNameCounter.GetUniqueName (), ret_type, param_types, typeof (DynamicMethodNameCounter), true);
#pragma warning restore IL3050

jonathanpeppers avatar Feb 28 '24 22:02 jonathanpeppers