Commit 45437e2
authored
[Java.Interop] suppress IL3050 with
Context: dotnet/android#8758 (comment)
Context: #1192
Context: 2197579
In 7d1e705 and b8f6f88, we suppressed IL3050, an AOT-related
warning with:
// FIXME: #1192
[UnconditionalSuppressMessage ("AOT", "IL3050")]
// Problematic code here
We don't immediately *plan* to support NativeAOT on Android in .NET 9,
so it would be nice if we could suppress the warning *for now*.
However, if/when anyone tried to use this code in a NativeAOT context
such as 2197579, they *should* get a warning (but didn't).
We should instead use:
// FIXME: #1192
#pragma warning disable IL3050
// Problematic code here
#pragma warning restore IL3050
This will prevent us from introducing new `IL3050` and related
warnings, but if anyone consumes `Java.Interop.dll` from NativeAOT
they will see the warning.
This (re-)introduces IL3050 warnings in the build for
`samples/Hello-NativeAOTFromJNI` (2197579):
% dotnet publish -c Release -r osx-x64
…
…/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs(665): AOT analysis warning IL3050: Java.Interop.JniRuntime.JniValueManager.<GetObjectArrayMarshaler>g__MakeGenericMethod|41_0(MethodInfo,Type): Using member 'System.Reflection.MethodInfo.MakeGenericMethod(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime.
…/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs(381): AOT analysis warning IL3050: Java.Interop.JniRuntime.JniValueManager.<GetInvokerType>g__MakeGenericType|31_1(Type,Type[]): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime.
…/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs(789): AOT analysis warning IL3050: Java.Interop.JavaPeerableValueMarshaler.CreateParameterToManagedExpression(JniValueMarshalerContext,ParameterExpression,ParameterAttributes,Type): Using member 'System.Linq.Expressions.Expression.Call(Expression,String,Type[],Expression[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. Calling a generic method requires dynamic code generation. This can be suppressed if the method is not generic.
…/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs(284): AOT analysis warning IL3050: Java.Interop.JniRuntime.JniTypeManager.MakeGenericType(Type,Type): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime.
…/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs(277): AOT analysis warning IL3050: Java.Interop.JniRuntime.JniTypeManager.MakeArrayType(Type): Using member 'System.Type.MakeArrayType()' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available.#pragma (#1201)1 parent 1c9c8c9 commit 45437e2
File tree
2 files changed
+16
-10
lines changed- src/Java.Interop/Java.Interop
2 files changed
+16
-10
lines changedLines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | | - | |
276 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
277 | 279 | | |
278 | | - | |
279 | 280 | | |
280 | | - | |
281 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
282 | 286 | | |
283 | 287 | | |
284 | 288 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
374 | 373 | | |
375 | | - | |
376 | 374 | | |
377 | 375 | | |
378 | 376 | | |
379 | 377 | | |
380 | 378 | | |
| 379 | + | |
| 380 | + | |
381 | 381 | | |
| 382 | + | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
| |||
657 | 658 | | |
658 | 659 | | |
659 | 660 | | |
660 | | - | |
661 | 661 | | |
662 | | - | |
663 | 662 | | |
| 663 | + | |
| 664 | + | |
664 | 665 | | |
| 666 | + | |
665 | 667 | | |
666 | 668 | | |
667 | 669 | | |
| |||
0 commit comments