-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
AOT + System.Reflection.Emit + ConstructorInfo doesn't work as expected #17665
Comments
After this point I'm in way over my head. That said, I found this "interesting". Get "diagnostic" outputs, so we can see what the JIT is doing:
Within They both start with the same IL, which is a good sanity check:
Things get "weird" -- to me -- when we hit the JIT:
AOT:
In particular,
Is the lack of I just found it "interesting". |
So the original problem is fixed, but another problem is still there. |
Compiling with /p:AndroidLinkMode=None fixes the problem. |
So we have two different sized assemblies with the same MVID, some assemblies are AOTed against the first version, some are AOTed against the second version, which probably causes the problem. The AOT runtime can't detect this because the MVIDs are the same. |
There was a bug in cecil which caused MVID calculation to be incorrect, but it was fixed before 2019-10 was branched: |
@vargaz is this issue fixed on our side? |
Changes: mono/api-snapshot@fc50bc4...45a61d9 $ git diff --shortstat fc50bc4f...45a61d93 22 files changed, 775 insertions(+), 474 deletions(-) Changes: dotnet/cecil@a6c8f5e...a6a7f5c $ git diff --shortstat a6c8f5e1...a6a7f5c0 55 files changed, 818 insertions(+), 530 deletions(-) Changes: mono/corefx@1f87de3...49f1c45 $ git diff --shortstat e4f7102b...49f1c453 38 files changed, 1171 insertions(+), 419 deletions(-) Changes: dotnet/linker@ebe2a1f...e8d054b $ git diff --shortstat ebe2a1f4...e8d054bf 137 files changed, 5360 insertions(+), 1781 deletions(-) Changes: mono/mono@8946e49...18920a8 $ git diff --shortstat 8946e49a...18920a83 1811 files changed, 47240 insertions(+), 48331 deletions(-) Changes: xamarin/xamarin-android-api-compatibility@a61271e...50a3c52 $ git diff --shortstat a61271e0...50a3c52d 1 file changed, 2 insertions(+), 791 deletions(-) Fixes: #3619 Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1005448 Context: https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/967582 Context: https://github.com/dotnet/coreclr/issues/26370 Context: https://github.com/dotnet/coreclr/issues/26479 Context: https://github.com/dotnet/corefx/issues/40455 Context: https://github.com/dotnet/corefx/issues/40578 Context: mono/mono#7377 Context: mono/mono#12421 Context: mono/mono#12586 Context: mono/mono#14080 Context: mono/mono#14725 Context: mono/mono#14772 Context: mono/mono#15261 Context: mono/mono#15262 Context: mono/mono#15263 Context: mono/mono#15307 Context: mono/mono#15308 Context: mono/mono#15310 Context: mono/mono#15646 Context: mono/mono#15687 Context: mono/mono#15805 Context: mono/mono#15992 Context: mono/mono#15994 Context: mono/mono#15999 Context: mono/mono#16032 Context: mono/mono#16034 Context: mono/mono#16046 Context: mono/mono#16192 Context: mono/mono#16308 Context: mono/mono#16310 Context: mono/mono#16369 Context: mono/mono#16380 Context: mono/mono#16381 Context: mono/mono#16395 Context: mono/mono#16411 Context: mono/mono#16415 Context: mono/mono#16486 Context: mono/mono#16570 Context: mono/mono#16605 Context: mono/mono#16616 Context: mono/mono#16689 Context: mono/mono#16701 Context: mono/mono#16712 Context: mono/mono#16742 Context: mono/mono#16759 Context: mono/mono#16803 Context: mono/mono#16808 Context: mono/mono#16824 Context: mono/mono#16876 Context: mono/mono#16879 Context: mono/mono#16918 Context: mono/mono#16943 Context: mono/mono#16950 Context: mono/mono#16974 Context: mono/mono#17004 Context: mono/mono#17017 Context: mono/mono#17038 Context: mono/mono#17040 Context: mono/mono#17083 Context: mono/mono#17084 Context: mono/mono#17133 Context: mono/mono#17139 Context: mono/mono#17151 Context: mono/mono#17180 Context: mono/mono#17278 Context: mono/mono#17549 Context: mono/mono#17569 Context: mono/mono#17665 Context: mono/mono#17687 Context: mono/mono#17737 Context: mono/mono#17790 Context: mono/mono#17924 Context: mono/mono#17931 Context: https://github.com/mono/mono/issues/26758 Context: https://github.com/mono/mono/issues/37913 Context: xamarin/xamarin-macios#7005
Changes: mono/api-snapshot@fc50bc4...45a61d9 $ git diff --shortstat fc50bc4f...45a61d93 22 files changed, 775 insertions(+), 474 deletions(-) Changes: dotnet/cecil@a6c8f5e...a6a7f5c $ git diff --shortstat a6c8f5e1...a6a7f5c0 55 files changed, 818 insertions(+), 530 deletions(-) Changes: mono/corefx@1f87de3...49f1c45 $ git diff --shortstat e4f7102b...49f1c453 38 files changed, 1171 insertions(+), 419 deletions(-) Changes: dotnet/linker@ebe2a1f...e8d054b $ git diff --shortstat ebe2a1f4...e8d054bf 137 files changed, 5360 insertions(+), 1781 deletions(-) Changes: mono/mono@8946e49...18920a8 $ git diff --shortstat 8946e49a...18920a83 1811 files changed, 47240 insertions(+), 48331 deletions(-) Changes: xamarin/xamarin-android-api-compatibility@a61271e...50a3c52 $ git diff --shortstat a61271e0...50a3c52d 1 file changed, 2 insertions(+), 791 deletions(-) Fixes: #3619 Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1005448 Context: https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/967582 Context: https://github.com/dotnet/coreclr/issues/26370 Context: https://github.com/dotnet/coreclr/issues/26479 Context: https://github.com/dotnet/corefx/issues/40455 Context: https://github.com/dotnet/corefx/issues/40578 Context: mono/mono#7377 Context: mono/mono#12421 Context: mono/mono#12586 Context: mono/mono#14080 Context: mono/mono#14725 Context: mono/mono#14772 Context: mono/mono#15261 Context: mono/mono#15262 Context: mono/mono#15263 Context: mono/mono#15307 Context: mono/mono#15308 Context: mono/mono#15310 Context: mono/mono#15646 Context: mono/mono#15687 Context: mono/mono#15805 Context: mono/mono#15992 Context: mono/mono#15994 Context: mono/mono#15999 Context: mono/mono#16032 Context: mono/mono#16034 Context: mono/mono#16046 Context: mono/mono#16192 Context: mono/mono#16308 Context: mono/mono#16310 Context: mono/mono#16369 Context: mono/mono#16380 Context: mono/mono#16381 Context: mono/mono#16395 Context: mono/mono#16411 Context: mono/mono#16415 Context: mono/mono#16486 Context: mono/mono#16570 Context: mono/mono#16605 Context: mono/mono#16616 Context: mono/mono#16689 Context: mono/mono#16701 Context: mono/mono#16712 Context: mono/mono#16742 Context: mono/mono#16759 Context: mono/mono#16803 Context: mono/mono#16808 Context: mono/mono#16824 Context: mono/mono#16876 Context: mono/mono#16879 Context: mono/mono#16918 Context: mono/mono#16943 Context: mono/mono#16950 Context: mono/mono#16974 Context: mono/mono#17004 Context: mono/mono#17017 Context: mono/mono#17038 Context: mono/mono#17040 Context: mono/mono#17083 Context: mono/mono#17084 Context: mono/mono#17133 Context: mono/mono#17139 Context: mono/mono#17151 Context: mono/mono#17180 Context: mono/mono#17278 Context: mono/mono#17549 Context: mono/mono#17569 Context: mono/mono#17665 Context: mono/mono#17687 Context: mono/mono#17737 Context: mono/mono#17790 Context: mono/mono#17924 Context: mono/mono#17931 Context: https://github.com/mono/mono/issues/26758 Context: https://github.com/mono/mono/issues/37913 Context: xamarin/xamarin-macios#7005
@vargaz ^ ? |
…mono/mono#17667) Fixes mono/mono#17665. Commit migrated from mono/mono@803c657
Changes: mono/api-snapshot@6f14e43...8ea1d66 $ git diff --shortstat 6f14e433...8ea1d663 21 files changed, 719 insertions(+), 444 deletions(-) Changes: mono/boringssl@4ca62c5...d7b108e $ git diff --shortstat 4ca62c57...d7b108ee 1 file changed, 1 insertion(+) Changes: dotnet/cecil@cb6c1ca...a6a7f5c $ git diff --shortstat cb6c1ca9...a6a7f5c0 47 files changed, 587 insertions(+), 444 deletions(-) Changes: mono/corefx@10a41e9...5940515 $ git diff --shortstat 10a41e9f...59405155 55 files changed, 1382 insertions(+), 369 deletions(-) Changes: mono/mono@18920a8...2edccc5 $ git diff --shortstat 18920a83...2edccc52 1393 files changed, 44742 insertions(+), 90381 deletions(-) Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1005448 Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1005448 Context: KSP-CKAN/CKAN#2881 Context: mono/mono#10559 Context: mono/mono#12249 Context: mono/mono#12337 Context: mono/mono#12995 Context: mono/mono#13777 Context: mono/mono#15006 Context: mono/mono#15010 Context: mono/mono#15181 Context: mono/mono#15805 Context: mono/mono#15845 Context: mono/mono#16026 Context: mono/mono#16206 Context: mono/mono#16410 Context: mono/mono#16513 Context: mono/mono#16557 Context: mono/mono#16588 Context: mono/mono#16632 Context: mono/mono#16701 Context: mono/mono#16778 Context: mono/mono#17053 Context: mono/mono#17084 Context: mono/mono#17133 Context: mono/mono#17151 Context: mono/mono#17161 Context: mono/mono#17190 Context: mono/mono#17278 Context: mono/mono#17278 Context: mono/mono#17317 Context: mono/mono#17367 Context: mono/mono#17389 Context: mono/mono#17546 Context: mono/mono#17549 Context: mono/mono#17569 Context: mono/mono#17601 Context: mono/mono#17665 Context: mono/mono#17687 Context: mono/mono#17737 Context: mono/mono#17790 Context: mono/mono#17869 Context: mono/mono#17878 Context: mono/mono#17916 Context: mono/mono#17924 Context: mono/mono#17926 Context: mono/mono#17931 Context: mono/mono#18213 Context: mono/mono#18221 Context: mono/mono#18273 Context: mono/mono#18276 Context: mono/mono#18317 Context: mono/mono#18388 Context: mono/mono#18455
Changelog: Mono 6.10.0 Release Notes Release date: 19 May 2020 Highlights Various bugfixes In Depth Runtime WebAssembly We continue to work on making our WebAssembly support better. Various sets of issues have been resolved in this release and general performance and feature work is happening as well. Community improvements for AIX/PASE and Haiku The ports for these systems received a bunch of improvements from community contributor Calvin Buckley (@NattyNarwhal). Class Libraries CoreFX integration We continued to replace some of our classes with the implementation from CoreFX to improve performance and compatibility with .NET. Tools Resolved Issues 15808 - dladdr shim for gmodule; try to enable crash reporter on AIX 15894 - Move MonoError from managed wrappers to native wrappers. 16461 - [interp] Non-recursive interpreter 16746 - Clean up map.c /map.h 16785 - Modify run-jenkins.sh to adapt wasm build for the OSX CI lane 16816 - [wasm][tests] WASM Safari browser tests 16832 - Replace embedded libgc with Unity fork of recent Boehm (bdwgc) 16855 - [runtime] Add portable cached array creation functions and replace gcc-specific impl. 16949 - [netcore] Propagate ALCs through reflection functions 16954 - [llvm] Use explicit null checks with LLVM. 16982 - Replace mono_assembly_name_free use with mono_assembly_name_free_internal. 16992 - [Coop] Unconvert Microsoft.Win32.NativeMethods. 17116 - [llvm] Use -place-safepoints in JIT mode too 17119 - Inline TLS access. 17131 - Update MERP event type to MonoAppCrash 17160 - Enable more hw intrinsics for AOT 17162 - Now IsExpired property for FormsAuthenticationTicket compares two dates with same kind (UTC) 17163 - [WinForms] Fix Recalculate in ScrollableControl 17173 - [sgen] Optimize LOS for better locality and parallelization. 17195 - Fixes #17190: SerializationException on ListViewItemCount 17212 - [offsets-tool] Update the README. 17214 - [master] Update dependencies from dotnet/arcade 17219 - [mini] Fix check for FastAllocateString that used old name 17222 - Fix check in fix_libc_name to trigger only for libc, not libcups or other names … 17223 - Enable GSS on Linux 17225 - [Mono.Posix] Add support for memfd_create() and file sealing 17226 - [interp] Kill more instructions 17227 - Incorrect constrained virtual call in method using gsharedvt for reference type. 17228 - Running –enable-msvc-only didn’t find jay.vcxproj. 17229 - [interp] Small cleanups 17230 - [netcore] Disable some SafeWaitHandle tests everywhere, not just Linux 17231 - [man] Update MONO_IOMAP docs as it no longer works with corefx System.IO 17233 - Revert mono_runtime_set_main_args in 44ff0597b835d0af62f526169dba3b365c9c3411. 17236 - [sgen] Fix invalid value passed to write barrier 17237 - [netcore] Implement System.IO.HasOverriddenBeginEndRead(Write) icalls 17238 - Add drawing type converters to mobile profiles 17243 - [netcore] Port CoreCLR implementation of Exception.SetCurrentStackTrace 17249 - [mini] print inserted instruction in verbose logging 17251 - [mini] trace snippet should restore return value 17252 - [System.Net.Http] Clean up HttpMessageHandler setup 17254 - Remove varargs from g_assert and g_assert_not_reachable (save 200+ bytes per frame in wasm interp). 17255 - [tests] Disable tests that crash on android sdks 17261 - [sdks] Android runner: properly shutdown runtime for Mono.Debugger.Soft test app 17262 - [eglib] Add newline for failure check prints 17263 - Fix g_assert_not_reached message regression. 17266 - [wasm] Continue loading app even when .pdb files are not found 17269 - Upgrade MSVC native runtime build to VS2019. 17270 - Add null check around sslStream when trying to dispose in MonoTlsStream 17272 - Update Linker. This fixes a Xamarin.Android breakage 17275 - Bump corefx to get Azure testhost change 17279 - Generate LLVM IR for OP_XEQUAL that is recognized by LLVM’s vector pattern recognizers. 17294 - [loader] Fix gnu/lib-names.h define 17297 - Mirror changes from mono/coreclr 17298 - [coop] Use bitfields for coop state machine state representation 17302 - Fix C++ WebAssembly build. 17305 - Fix msvc build warning, empty source main-core.c. 17307 - Bumps corefx to mono/corefx@8e3b279 17312 - Update dotnet sdk version 17313 - [ci] Use Xcode11.1 for XI/XM Mono SDK builds 17315 - [loader] Add an explicit define DISABLE_DLLMAP to control dllmap usage 17318 - [netcore] Avoid suspending threads in Environment.Exit, it can hang process 17321 - [GTK] Bump bockbuild for GtkViewport autoscrolling patch. 17322 - [bcl] Update BCL Linked Size 17326 - [interp] Add constant propagation of integers 17328 - [wasm][http] WasmHttpMessageHandler StreamingEnabled default to false 17330 - Fix SafeHandle marshalling in ref/in/out parameters 17331 - Initial telemetry for netcore builds 17336 - [bcl] add WriteLine(string) override to CStreamWriter needed due to corefx import 17338 - [jit] Fix is_reference checks for intrinsics with byref parameters. 17340 - [wasm] Bump emscripten. Remove generated python cache files. 17341 - [bcl][jit] implement Interlocked.Exchange in terms of object 17344 - [wasm] Add a –native-lib option to the packager to allow linking additional native libraries. 17345 - [cxx][x86] int/ptr casts. 17346 - [cxx][x86] ifndef DISABLE_JIT around mono_arch_emit_prolog. 17347 - [cxx][x86][amd64] Remove unused STORE_MEM_IMM. 17348 - [cxx][netcore] Goto around init. 17349 - [ci] Improve netcore build telemetry by running nupkg and tests through build.sh 17350 - Use functions instead of macros for is_in/is_out. 17351 - [wasm][xunit tests] Disable System.IO.Compression.Tests.BrotliEncoderTests 17355 - [master] Update dependencies from dotnet/core-setup dotnet/corefx 17358 - Removing execution of network tests from WatchOs. 17361 - [netcore] Fix build for Windows with cygwin 17362 - [interp] Constant folding for integers 17366 - [netcore] Remove Gader] Unmanaged library refactoring and NativeLibrary implementation 17370 - [bcl] Remove CompareExchange_T 17377 - [cxx] Int vs. enum, static for efficiency, cleanup, fix typo. 17379 - [cxx] [wasm] m2n-gen int/ptr casts. 17380 - [jit][x86ieldAwaitable struct readonly 17387 - [netcore] Managed ThreadPool implementation 17388 - [interp][wasm] Remove more varargs to conserve stack. 17391 - Remove the Legacy TLS Provider. 17393 - Cleaning up SslStream, MobileAuthenticatedStrea 17537 - [merp] Introduce a new ‘dump mode’ that allows different signal behavior when dumping 17538 - [interp] fix code length for JitInfo 17551 - [mini] Initial tiered compilation work 17553 - Mirror changes from mono/corefx,corert 17554 - [runtime] Make mono_thread_manage external only 17558 - [cxx] Compile mini-llvm.c as C++ if configure -enable-cxx. 17559 - [wasm] Propagate exit code from Main in the test runner. 17565 - Mirror changes from mono/coreclr,corert,corefx 17566 - [runtime] Unbalanced GC Unsafe transitions before shutdown 17570 - [cxx][x86] int/ptr casts 17571 - Mirror changes from mono/coreclr 17577 - [master] Update dependencies from dotnet/arcade dotnet/core-setup dotnet/corefx 17579 - Fix #16206: Change HotkeyPrefix default value in TabControlPainter.cs 17583 - [dim][regression] Explicit interface override 17589 - [embed] Assert when call mono_runtime_object_init 17590 - Bump CoreFX to pickup corefx #367 to fix #17133. 17592 - [eglib] Handle dli.dli_sname being NULL in g_module_address (). 17595 - [interp] fix signature mismatch between jit<>interp for string constructor 17596 - [wasm] Fix build problems. 17600 - [wasm] Print a useful error message instead of a signature mismatch error on missing icalls. 17602 - Avoid caching of System.dll image and types as they may be unloaded w… 17607 - Implement GC.GetGCMemoryInfo 17608 - Fix #12337: Refact selected indexes in TabControl.Remove 17609 - Mirror changes from mono/coreclr,corefx 17611 - [runtime] Add a –enable-minimal=threads configure option to disable threading support. Use it on wasm. 17612 - Remove some unused icalls. 17615 - [mini] Fix Coverity CID 1455161 & 1455162 17616 - [netcore] Report errors on Windows CI 17623 - [interp] Optimize call path 17625 - [interp] Avoid emitting MINT_SAFEPOINT for every single call 17628 - [System.Net.Http]: Bring HttpClient from CoreFX on monotouch and xammac. 17631 - Bump mono/corefx@6e65509 17636 - [interp] Fix interp logging 17639 - [wasm] Fix xunit test ninja errors. 17641 - [interp] Handle remoting field access same as jit 17642 - [threadpool] cache processor count 17646 - Mono NetCore Windows only build/test. 17648 - [llvm] Fix a case where we treated the dreg of a store_membase instruction as a dreg, its actually the base reg. 17650 - [interp] s/MONO_API_ERROR_INIT/error_init_reuse/g 17653 - [WinForms] Returns real installed input languages on Windows 17654 - [interp] Use GetType instrinsic also on net4x 17660 - [WinForms] Fix #10559 In MaskedTextBox wrong Lines value when Mask se… 17661 - [netcore] Cleanups. 17662 - [WinForms] Fix #12249 scroll orientation was not defined in ScrollEventArgs 17664 - [iOS] Match changes done in xamarin-macios in the SDK runtime. 17666 - [netcore] Improve default constructor lookup, 17667 - [jit] Call mono_class_setup_fields () before accessing field->offset. Fixes mono/mono#17665. 17669 - [WinForms]: Fix #16632 special values (-1 and -2) of ListView Column … 17670 - [WinForms] Fix TabPage position when enabling MultiLine 17672 - Allow runtime to be built with C++ on AIX 17673 - [netcore] Improve Array.CreateInstance 17676 - [WinForms] Fix #13777 DrawToBitmap() did not draw children controls 17680 - [mono] Fix ProcessExit handler argument. 17681 - Remove handles from ves_icall_System_Array_InternalCreate. 17683 - [interp] use mask instead of bool expression 17688 - Intrinsify Activator.CreateInstance for value types with no ctor 17690 - [master] Update dependencies from dotnet/arcade dotnet/core-setup dotnet/corefx 17691 - Explicit update/init only LLVM BTLS repro on external MSVC build. 17692 - [jit] Allow Unsafe.As<TFrom, TTo> on gsharedvt types. 17694 - Bump Corefx 17695 - Mirror changes from mono/coreclr 17698 - [wasm] Build the tests with –no-native-strip. 17701 - [loader] Skip the full pinvoke resolution process for __Internal 17706 - Fix MSVC intellisense for LLVM sources. 17708 - Remove handles from ves_icall_System_Array_CanChangePrimitive. 17711 - Handles reduction – 4 MERP functions. 17712 - error_init reduction. 17713 - Remove handles from System.Diagnostics.Debugger. 17719 - [netcore] Complete Monitor.LockContentionCount implementation 17723 - [merp] Remove extraneous waitpid invocation 17727 - [debugger] Assert when async debug a generic method 17730 - Switch away from Start-Process, Wait-Process in build.ps1. 17731 - [WinForms][UIA] Add to the PropertyGrid new internal event to track grid items expanded state update 17732 - [Wasm] Enabled –preload-files without AOT 17738 - [runtime] Fix locking in mono_get_seq_points (). 17739 - [aot] Improve the aot mangler a bit, handle bool/char as a primitive type and avoid emitting a System prefix. 17740 - [profiler] Fix log profiling of native to managed wrappers 17744 - [sdks] Add xunit to iOS test runner and add results reporting 17748 - [wasm] Bump emscripten. 17749 - [LLVM] Change llvm submodule to dotnet-org fork of official LLVM git repo 17751 - [Mono.Security] Do not decode data beyond detected length in ASN1 parser 17753 - [netcore] Run individual CoreCLR test suites 17755 - [WinForms] Fix #16557 DefaultCellStyle was not cloned deeply in DataG… 17757 - [netcore] Fix RuntimePropertyInfo.GetValue() in FullAOT scenarios 17758 - Bump corefx to pick up mono/corefx#370 17761 - Mirror changes from mono/corefx,coreclr,corert 17772 - Delete some LLVM test cases from make dist 17773 - [wasm] Change netcore support to use a prebuilt corefx runtime. 17777 - Mirror changes from mono/corefx,coreclr 17778 - [llvm] use multiple cores to build llvm if ninja7782 - [interp] Add some missing netcore intrinsics. 17784 - [interp] Add some inline checks from the JIT. 17785 - [MacSDK] Bump xamarin-gtk-theme.py to latest revision from private bockbuild 17789 - [Wasm] Forced filesystem creation 17795ULL pointer crash in mono_decompose_vtype_opts(). 17803 - Mirror changes from mono/runtime 17806 - Remove handles/MonoError from Mono.RuntimeGPtrArrayHandle. 17816 - [Wasm] Update emscripten to 1.39.3 17827 - [llvm] Add support for LLVM JInt is a generic valuetype. 18577 - [2019-12] Bump msbuild to track mono-2019-10 18591 - [2019-12] [runtime] Disable lldb backtrace display on osx, it hangs on attaching in lldb. 18595 - [2019-12] configure.ac: remove AC_SEARCH_LIBS for libintl 18611 - [2019-12] [merp] MONO_DEBUG=no-gdb-stacktrace shouldn’t disable MERP 18620 - [2019-12] [corlib] Split corlib xunit tests even more for iOS 18682 - [2019-12] [aot] Avoid inflating gparams with byreflike types during generic sharing. 18705 - Update deprecated query parameter to header 18723 - [2019-12] [merp] Add an exception type for managed exceptions 18733 - [2019-12] [NUnitLite] Bump nunitlite submodule. 18744 - [2019-12] [iOS] Replace removed dsymutil -t switch with -num-threads 18786 - [2019-12] Allow users to switch to MonoWebRequestHandler on Android via UI 18792 - [2019-12] Bump msbuild to track mono-2019-10 18830 - [2019-12] Move offsets-tool into mono/tools 18833 - [2019-12] Make MonoWebRequestHandler linker friendly 18839 - [2019-12] [merp] Increase buffer size for state dump 18862 - [2019-12] Bump msbuild to track mono-2019-10 18889 - [2019-12] Move TestEnvVarSwitchForInnerHttpHandler to nunit (from xunit) 18908 - [2019-12] [bcl] Default XmlSerializer stream serialize to UTF8 Encoding 18911 - Bump bockbuild to bring in Gtk# regression fix 18921 - [2019-12] [merp] Capture Environment.FailFast message in crash report 18946 - [2019-12] [sgen] Disable managed allocator when using nursery-canaries 18956 - [2019-12] Remove TestEnvVarSwitchForInnerHttpHandler test 18964 - [2019-12] [merp] Produce hashes for unmanaged thread stacks also 18984 - [2019-12] Added some parenthesis and a cast to control order of operations. 18986 - [2019-12] Bump msbuild to track mono-2019-10 19018 - [2019-12][runtime] Improve handling crashing signals 19050 - [2019-12] [debugger] Enable reading embedded ppdb 19078 - [2019-12] Bump msbuild to track mono-2019-12 19119 - [2019-12] [merp] Create a signal (‘source’) breadcrumb for the crash dump process 19205 - [2019-12] Bump msbuild to track mono-2019-12 19208 - [2019-12] [corlib] Capture the ExceptionDispatchInfo when rethrowing from TaskContinuation 19243 - [2019-12] [merp] Add breadcrumb for StackHash 19368 - [2019-12] [amd64] align application stack pointer in signal handler 19423 - [2019-12] Force Python 3.x from env in shebang lines 19428 - [mono-2019-12] Bump corefx to get mono/corefx#396 19622 - [2019-12] Bump msbuild to track mono-2019-12 19641 - [2019-12] [System.Runtime.Serialization] Work around specified cast is not valid 19662 - [2019-12] Bump msbuild to track mono-2019-12
Context: dotnet/android#3753
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3203657
Small repro to help investigate a regression we're seeing when trying
to use mono/2019-10 with Xamarin.Android.
Background: Constructors! (Am I right?!)
Xamarin.Android "binds" Java code so that it can be used as if it were
C# code. Part of this binding is involves "peer types": in order for
things to work as expected, when a C# type inherits a Java type, a
"Java Callable Wrapper" (JCW) is constructed for the C# type. This
JCW is a "peer type": all C# subclases of
Java.Lang.Object
hold ahandle to a corresponding "Java peer", which is stored in the
Object.handle
field.C# types can be created from Java by invoking the Java constructor
on the Java Callable Wrapper.
This is where things get weird: in a "Java started the constructor"
scenario, we have a handle to an existing Object instance which we
want to wrap with a new C# instance. However, we don't want all C#
subclasses to (manually!) write some
MyType(IntPtr)
constructor, sohow do we invoke the C# constructor when we already have the Java
instance?
By trickery, that's how: instead of directly calling the constructor
of the C# type, we instead create a new delegate -- using
DynamicMethod
-- which:Creates a new uninitialized instance of the C# type by using
FormatterServices.GetUninitializedObject()
Set the
Object.handle
field on the uninitialized instance.Call the C# constructor, using the uninitialized instance, to
initialize the instance.
This way the C# type doesn't need to know or explicitly deal with JNI
handles. It Just Works.
This system has worked for as long as Mono for Android has existed.
(Aside: what's "funny" is that while this works with current
Xamarin.Android v10.1 and is only failing with mono/2019-10, this
desktop repro fails in the same way with 6.4.0 & mono/2019-06!)
...until mono/2019-10, when AOT is used.
Thus, this repro project:
CoreLib.dll
is analogous toMono.Android.dll
, and contains theConstructorBuilder.CreateDelegate()
type which does the"create an uninitialized instance, set the handle, call the ctor"
dance. It also contains
BaseClass
, which is analogous toJava.Lang.Object
, and contains thehandle
field.UserLib.dll
, which would be analogous to a Xamarin.AndroidApp.dll
assembly, with e.g. a customActivity
subclass.AotSreCtorInfo.exe
, the app which drives things.Instructions
Build the project:
Run the project:
With normal JIT use, it works as expected:
In particular, note the
ACTIVATION SCENARIO
message, and thatthis.handle=0x2a
in the preceeding message.AOT the assemblies with:
This runs
mono --aot
on each assembly.make run
aftermake aot
will use the AOT'd assemblies.This is where things to off the rails:
Note that
this.handle=0x00
, and NOACTIVATION SCENARIO
message isprinted.
This is a problem. Enabling AOT breaks expected app semantics.
Steps to Reproduce
Download and Unzip: AotSreCtorInfo.zip
Build it:
Run it:
This is normal & expected JIT behavior & output. Record it. (Or see above.)
Build for AOT
Re-run using AOT:
This is expected to be identical to (3). It isn't.
Current Behavior
When AOT is used,
BaseClass.handle
is not set to42
before invoking theMyClass
constructor.When AOT is not used,
BaseClass.handle
is set to 42 before theMyClass
constructor is invoked.Expected Behavior
AOT behavior should match non-AOT behavior:
BaseClass.handle
should be set to 42 before theMyClass
constructor is executed.On which platforms did you notice this
Version Used:
The text was updated successfully, but these errors were encountered: