Bug 60843 - Type 0x15 not handled in custom attr value decoding
Summary: Type 0x15 not handled in custom attr value decoding
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection ()
Version: 5.8 (2017-10)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Katelyn Gadd
URL:
Depends on:
Blocks:
 
Reported: 2017-11-23 23:13 UTC by Marek Safar
Modified: 2018-04-16 18:27 UTC (History)
5 users (show)

Tags: bugpool-archived
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Marek Safar 2017-11-23 23:13:55 UTC
I don't have good test case yet as it's part of big roslyn test suite

Type 0x15 not handled in custom attr value decoding
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool) [0x00022] in <ad462c3d033e458d8ccda7a092dd2715>:0
  at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider,System.Type,bool) [0x00013] in /Users/marek/git/mono/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:128
  at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider,System.Type,bool) [0x00037] in /Users/marek/git/mono/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:158
  at System.RuntimeType.GetCustomAttributes (bool) [0x00000] in /Users/marek/git/mono/mono/mcs/class/referencesource/mscorlib/system/rttype.cs:5081
  at A.Main () [0x0000b] in <5d166c190bc74bab9594a0fe0cb03819>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0004d] in <ad462c3d033e458d8ccda7a092dd2715>:0
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) [0x00016] in <ad462c3d033e458d8ccda7a092dd2715>:0
  at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00032] in /Users/marek/git/mono/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
  at System.Reflection.MethodBase.Invoke (object,object[]) [0x00000] in /Users/marek/git/mono/mono/mcs/class/referencesource/mscorlib/system/reflection/methodbase.cs:229
  at Roslyn.Test.Utilities.Desktop.RuntimeAssemblyManager/<>c__DisplayClass32_0.<Execute>b__0 () [0x0005d] in <a16275ecd6324c40be05504e91d652f3>:0
  at Roslyn.Test.Utilities.Desktop.DesktopRuntimeEnvironment.Capture (System.Action,int,string&,string&) [0x0003f] in <a16275ecd6324c40be05504e91d652f3>:0
  at Roslyn.Test.Utilities.Desktop.RuntimeAssemblyManager.Execute (string,string[],System.Nullable`1<int>,string&) [0x0006f] in <a16275ecd6324c40be05504e91d652f3>:0
Comment 1 Ludovic Henry 2017-11-24 01:13:09 UTC
Is it a runtime crash, like a SIGABRT or SIGSEGV? Which test suite is it, and how can we run it? Would you have a native stacktrace with the managed one you sent, or did you have a chance to attach with a native debugger?
Comment 2 Marek Safar 2017-11-24 10:29:50 UTC
Extracted repro

using System;

class A : Attribute
{
    public object X;
    public static void Main()
    {
        typeof(C<>.E).GetCustomAttributes(false);
    }
}
 
public class C<T>
{
    [A(X = C<int>.E.V)]
    public enum E { V }
}
Comment 3 Ludovic Henry 2017-11-27 16:36:16 UTC
I can reproduce with Mono 5.8.0.70 (2017-10/efce3b256a5).

I get the following stacktrace when running reproduction case from https://bugzilla.xamarin.com/show_bug.cgi?id=60843#c2 :

> Type 0x15 not handled in custom attr value decoding
> Stacktrace:
> 
>   at <unknown> <0xffffffff>
>   at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool) [0x0000b] in <ede5cf6930dc4b9a8366f15f6c89bbd0>:0
>   at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider,System.Type,bool) [0x00013] in <ede5cf6930dc4b9a8366f15f6c89bbd0>:0
>   at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider,System.Type,bool) [0x00037] in <ede5cf6930dc4b9a8366f15f6c89bbd0>:0
>   at System.RuntimeType.GetCustomAttributes (bool) [0x00000] in <ede5cf6930dc4b9a8366f15f6c89bbd0>:0
>   at A.Main () [0x00000] in <445cecd09d4b41ccb549c416cf93b0ab>:0
>   at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0004c] in <ede5cf6930dc4b9a8366f15f6c89bbd0>:0
> 
> Native stacktrace:
> 
> 	0   mono                                0x00000001081e3e81 mono_handle_native_crash + 257
> 	1   libsystem_platform.dylib            0x00007fff7f578f5a _sigtramp + 26
> 	2   ???                                 0x0000000000000000 0x0 + 0
> 	3   libsystem_c.dylib                   0x00007fff7f3a430a abort + 127
> 	4   mono                                0x00000001083bbaff mono_log_write_logfile + 351
> 	5   mono                                0x00000001083d38ce monoeg_g_log + 206
> 	6   mono                                0x000000010835c927 load_cattr_value + 1239
> 	7   mono                                0x000000010835c8df load_cattr_value + 1167
> 	8   mono                                0x000000010835b167 create_custom_attr + 1271
> 	9   mono                                0x0000000108359fa3 mono_custom_attrs_construct_by_type + 387
> 	10  mono                                0x000000010835bc87 mono_reflection_get_custom_attrs_by_type_handle + 87
> 	11  ???                                 0x000000010867120f 0x0 + 4435939855
> 	12  mono                                0x0000000108139d17 mono_jit_runtime_invoke + 1383
> 	13  mono                                0x00000001082fa204 do_runtime_invoke + 84
> 	14  mono                                0x00000001082fd829 do_exec_main_checked + 137
> 	15  mono                                0x00000001081a6d7f mono_jit_exec + 287
> 	16  mono                                0x00000001081a9574 mono_main + 9140
> 	17  mono                                0x00000001081296fd main + 253
> 	18  mono                                0x00000001081295f4 start + 52
> 
> Debug info from gdb:
> 
> (lldb) command source -s 0 '/tmp/mono-gdb-commands.s7w4dY'
> Executing commands in '/tmp/mono-gdb-commands.s7w4dY'.
> (lldb) process attach --pid 17012
> warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
> Process 17012 stopped
> * thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>     frame #0: 0x00007fff7f44867a libsystem_kernel.dylib`__wait4 + 10
> libsystem_kernel.dylib`__wait4:
> ->  0x7fff7f44867a <+10>: jae    0x7fff7f448684            ; <+20>
>     0x7fff7f44867c <+12>: movq   %rax, %rdi
>     0x7fff7f44867f <+15>: jmp    0x7fff7f43f791            ; cerror
>     0x7fff7f448684 <+20>: retq
> Target 0: (mono) stopped.
> 
> Executable module set to "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono".
> Architecture set to: x86_64h-apple-macosx.
> (lldb) thread list
> Process 17012 stopped
> * thread #1: tid = 0x24ed94, 0x00007fff7f44867a libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>   thread #2: tid = 0x24ed95, 0x00007fff7f447e7e libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
>   thread #3: tid = 0x24ed96, 0x00007fff7f43eeb2 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
> (lldb) thread backtrace all
> * thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>   * frame #0: 0x00007fff7f44867a libsystem_kernel.dylib`__wait4 + 10
>     frame #1: 0x00000001081e3f0e mono`mono_handle_native_crash + 398
>     frame #2: 0x00007fff7f578f5a libsystem_platform.dylib`_sigtramp + 26
>     frame #3: 0x00007fff7f447fcf libsystem_kernel.dylib`__pthread_kill + 11
>     frame #4: 0x00007fff7f585150 libsystem_pthread.dylib`pthread_kill + 333
>     frame #5: 0x00007fff7f3a430a libsystem_c.dylib`abort + 127
>     frame #6: 0x00000001083bbaff mono`mono_log_write_logfile + 351
>     frame #7: 0x00000001083d38ce mono`monoeg_g_log + 206
>     frame #8: 0x000000010835c927 mono`load_cattr_value + 1239
>     frame #9: 0x000000010835c8df mono`load_cattr_value + 1167
>     frame #10: 0x000000010835b167 mono`create_custom_attr + 1271
>     frame #11: 0x0000000108359fa3 mono`mono_custom_attrs_construct_by_type + 387
>     frame #12: 0x000000010835bc87 mono`mono_reflection_get_custom_attrs_by_type_handle + 87
>     frame #13: 0x000000010867120f
>     frame #14: 0x0000000108139d17 mono`mono_jit_runtime_invoke + 1383
>     frame #15: 0x00000001082fa204 mono`do_runtime_invoke + 84
>     frame #16: 0x00000001082fd829 mono`do_exec_main_checked + 137
>     frame #17: 0x00000001081a6d7f mono`mono_jit_exec + 287
>     frame #18: 0x00000001081a9574 mono`mono_main + 9140
>     frame #19: 0x00000001081296fd mono`main + 253
>     frame #20: 0x00000001081295f4 mono`start + 52
>   thread #2, name = 'SGen worker'
>     frame #0: 0x00007fff7f447e7e libsystem_kernel.dylib`__psynch_cvwait + 10
>     frame #1: 0x00007fff7f583662 libsystem_pthread.dylib`_pthread_cond_wait + 732
>     frame #2: 0x00000001083b2f9e mono`thread_func + 542
>     frame #3: 0x00007fff7f5826c1 libsystem_pthread.dylib`_pthread_body + 340
>     frame #4: 0x00007fff7f58256d libsystem_pthread.dylib`_pthread_start + 377
>     frame #5: 0x00007fff7f581c5d libsystem_pthread.dylib`thread_start + 13
>   thread #3, name = 'Finalizer'
>     frame #0: 0x00007fff7f43eeb2 libsystem_kernel.dylib`semaphore_wait_trap + 10
>     frame #1: 0x000000010835f71c mono`finalizer_thread + 556
>     frame #2: 0x000000010831b9d0 mono`start_wrapper + 704
>     frame #3: 0x00007fff7f5826c1 libsystem_pthread.dylib`_pthread_body + 340
>     frame #4: 0x00007fff7f58256d libsystem_pthread.dylib`_pthread_start + 377
>     frame #5: 0x00007fff7f581c5d libsystem_pthread.dylib`thread_start + 13
> (lldb) detach
> 
> =================================================================
> Got a SIGABRT while executing native code. This usually indicates
> a fatal error in the mono runtime or one of the native libraries
> used by your application.
> =================================================================
> 
> Process 17012 detached
> (lldb) quit
> [1]    17012 abort      mono repro.exe
Comment 4 Ludovic Henry 2018-03-19 13:46:00 UTC
https://github.com/mono/mono/pull/7640
Comment 5 Ludovic Henry 2018-03-21 20:04:04 UTC
Fixed in master with https://github.com/mono/mono/commit/7faa4620462fbce4b8797832c73e0f96411d1070