Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Jeff-Kesselman · Jun 08, 2014 at 06:27 PM · loggenericsstructcompiler bug

Why does Dictionary with a generic struct key blow the compiler up?

Its actually the new of the Dictionary that blows the compiler up.

 using System.Collections.Generic;
 
 
 namespace WWUtils.Math{
     [System.Serializable]
     struct Foo<T> {
 
     }
 
     public class Sparse3DMatrix<T> {
         Dictionary<Foo<int>, T> valueStore = new Dictionary<Foo<int>, T>();
 
 
     }
 }

If I make the struct not a generic, it compilers fine. If I make the key a generic class, it compiles fine. If I remove the new it compiles fine.

But as written above, I get the following stack trace in the log:

 -----CompilerOutput:-stdout--exitcode: 134--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
 * Assertion at class.c:1727, condition `class->image->dynamic || field->offset > 0' not met
 
 -----CompilerOutput:-stderr----------
 Stacktrace:
 
   at (wrapper managed-to-native) System.Reflection.MonoMethodInfo.get_method_info (intptr,System.Reflection.MonoMethodInfo&) <0x00004>
   at (wrapper managed-to-native) System.Reflection.MonoMethodInfo.get_method_info (intptr,System.Reflection.MonoMethodInfo&) <0x00004>
   at System.Reflection.MonoMethodInfo.GetMethodInfo (intptr) <0x00037>
   at System.Reflection.MonoMethodInfo.GetDeclaringType (intptr) <0x00037>
   at System.Reflection.MonoMethod.get_DeclaringType () <0x00014>
   at Mono.CSharp.TypeManager.IsGenericMethodDefinition (System.Reflection.MethodBase) <0x0001a>
   at Mono.CSharp.TypeManager.GetMethodName (System.Reflection.MethodInfo) <0x00012>
   at Mono.CSharp.MemberCache.AddMembers (System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.IMemberContainer) <0x0010e>
   at Mono.CSharp.MemberCache.AddMembers (System.Reflection.MemberTypes,Mono.CSharp.IMemberContainer) <0x00028>
   at Mono.CSharp.MemberCache.AddMembers (Mono.CSharp.IMemberContainer) <0x0004c>
   at Mono.CSharp.MemberCache..ctor (Mono.CSharp.IMemberContainer) <0x00188>
   at Mono.CSharp.TypeHandle..ctor (System.Type) <0x0011d>
   at Mono.CSharp.TypeHandle.GetTypeHandle (System.Type) <0x00063>
   at Mono.CSharp.TypeHandle.GetMemberCache (System.Type) <0x00010>
   at Mono.CSharp.TypeManager.MemberLookup_FindMembers (System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,bool&) <0x0026d>
   at Mono.CSharp.TypeManager.RealMemberLookup (System.Type,System.Type,System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,System.Collections.IList) <0x0012d>
   at Mono.CSharp.TypeManager.MemberLookup (System.Type,System.Type,System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,System.Collections.IList) <0x00022>
   at Mono.CSharp.Expression.MemberLookup (Mono.CSharp.CompilerContext,System.Type,System.Type,System.Type,string,System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.Location) <0x00041>
   at Mono.CSharp.Expression.MemberLookupFinal (Mono.CSharp.ResolveContext,System.Type,System.Type,string,System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.Location) <0x00066>
   at Mono.CSharp.New.DoResolve (Mono.CSharp.ResolveContext) <0x004d5>
   at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext,Mono.CSharp.ResolveFlags) <0x0015b>
   at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext) <0x00015>
   at Mono.CSharp.Assign.DoResolve (Mono.CSharp.ResolveContext) <0x00021>
   at Mono.CSharp.FieldInitializer.DoResolve (Mono.CSharp.ResolveContext) <0x00068>
   at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext,Mono.CSharp.ResolveFlags) <0x0015b>
   at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext) <0x00015>
   at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.BlockContext) <0x00015>
   at Mono.CSharp.TypeContainer.DoResolveFieldInitializers (Mono.CSharp.BlockContext) <0x002ad>
   at Mono.CSharp.TypeContainer.ResolveFieldInitializers (Mono.CSharp.BlockContext) <0x001ac>
   at Mono.CSharp.Constructor.Emit () <0x00138>
   at Mono.CSharp.TypeContainer.EmitConstructors () <0x003a3>
   at Mono.CSharp.TypeContainer.EmitType () <0x0009b>
   at Mono.CSharp.RootContext.EmitCode () <0x000aa>
   at Mono.CSharp.Driver.Compile () <0x00764>
   at Mono.CSharp.Driver.Main (string[]) <0x0008f>
   at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0x00043>
 
 Native stacktrace:
 
     0   mono                                0x002aa630 g_log_set_fatal_mask + 64
     1   mono                                0x002aa733 g_logv + 243
     2   mono                                0x002aa781 g_log + 65
     3   mono                                0x0014d079 mono_class_layout_fields + 2953
     4   mono                                0x0014c3a4 mono_method_set_generic_container + 5044
     5   mono                                0x00154e8d mono_class_init + 1229
     6   mono                                0x00220371 mono_type_get_object + 1473
     7   mono                                0x0018910d mono_domain_lookup_shared_generic + 18429
     8   ???                                 0x00767782 0x0 + 7763842
     9   ???                                 0x00767700 0x0 + 7763712
     10  ???                                 0x00767d38 0x0 + 7765304
     11  ???                                 0x02d3645d 0x0 + 47408221
     12  ???                                 0x043a4aa3 0x0 + 70929059
     13  ???                                 0x043a49fb 0x0 + 70928891
     14  ???                                 0x043a3c1f 0x0 + 70925343
     15  ???                                 0x043a3ae9 0x0 + 70925033
     16  ???                                 0x043a3a4d 0x0 + 70924877
     17  ???                                 0x02f8fd19 0x0 + 49872153
     18  ???                                 0x02f8fb0e 0x0 + 49871630
     19  ???                                 0x02f8f9a4 0x0 + 49871268
     20  ???                                 0x02f8f8a9 0x0 + 49871017
     21  ???                                 0x043c078e 0x0 + 71042958
     22  ???                                 0x043c0166 0x0 + 71041382
     23  ???                                 0x043c0023 0x0 + 71041059
     24  ???                                 0x043bf7da 0x0 + 71038938
     25  ???                                 0x043bf727 0x0 + 71038759
     26  ???                                 0x04445476 0x0 + 71586934
     27  ???                                 0x043ba454 0x0 + 71017556
     28  ???                                 0x043ba26e 0x0 + 71017070
     29  ???                                 0x043ba7b2 0x0 + 71018418
     30  ???                                 0x043ba719 0x0 + 71018265
     31  ???                                 0x043ba454 0x0 + 71017556
     32  ???                                 0x043ba26e 0x0 + 71017070
     33  ???                                 0x043ba1f6 0x0 + 71016950
     34  ???                                 0x043ba0a6 0x0 + 71016614
     35  ???                                 0x043b9dcd 0x0 + 71015885
     36  ???                                 0x043b9051 0x0 + 71012433
     37  ???                                 0x043b8d6c 0x0 + 71011692
     38  ???                                 0x043b6e9c 0x0 + 71003804
     39  ???                                 0x043b68fb 0x0 + 71002363
     40  ???                                 0x007f322d 0x0 + 8335917
     41  ???                                 0x0075b2a8 0x0 + 7713448
     42  ???                                 0x0075b62c 0x0 + 7714348
     43  mono                                0x0000ed62 mono_jit_find_compiled_method + 1538
     44  mono                                0x001fdfaa mono_runtime_invoke + 170
     45  mono                                0x00200257 mono_runtime_exec_main + 663
     46  mono                                0x001ffaec mono_runtime_run_main + 476
     47  mono                                0x0009f48f mono_jit_exec + 239
     48  mono                                0x0009f6e0 mono_jit_exec + 832
     49  mono                                0x000a183e mono_main + 7118
     50  mono                                0x000024b8 main + 56
     51  mono                                0x00002435 start + 53
 
 Debug info from gdb:
 
 
 =================================================================
 Got a SIGSEGV while executing native code. This usually indicates
 a fatal error in the mono runtime or one of the native libraries 
 used by your application.
 =================================================================
 
 -----EndCompilerOutput---------------
 - Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll
 Internal compiler error. See the console log for more information. output was:Stacktrace:
 
   at (wrapper managed-to-native) System.Reflection.MonoMethodInfo.get_method_info (intptr,System.Reflection.MonoMethodInfo&) <0x00004>
   at (wrapper managed-to-native) System.Reflection.MonoMethodInfo.get_method_info (intptr,System.Reflection.MonoMethodInfo&) <0x00004>
   at System.Reflection.MonoMethodInfo.GetMethodInfo (intptr) <0x00037>
   at System.Reflection.MonoMethodInfo.GetDeclaringType (intptr) <0x00037>
   at System.Reflection.MonoMethod.get_DeclaringType () <0x00014>
   at Mono.CSharp.TypeManager.IsGenericMethodDefinition (System.Reflection.MethodBase) <0x0001a>
   at Mono.CSharp.TypeManager.GetMethodName (System.Reflection.MethodInfo) <0x00012>
   at Mono.CSharp.MemberCache.AddMembers (System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.IMemberContainer) <0x0010e>
   at Mono.CSharp.MemberCache.AddMembers (System.Reflection.MemberTypes,Mono.CSharp.IMemberContainer) <0x00028>
   at Mono.CSharp.MemberCache.AddMembers (Mono.CSharp.IMemberContainer) <0x0004c>
   at Mono.CSharp.MemberCache..ctor (Mono.CSharp.IMemberContainer) <0x00188>
   at Mono.CSharp.TypeHandle..ctor (System.Type) <0x0011d>
   at Mono.CSharp.TypeHandle.GetTypeHandle (System.Type) <0x00063>
   at Mono.CSharp.TypeHandle.GetMemberCache (System.Type) <0x00010>
   at Mono.CSharp.TypeManager.MemberLookup_FindMembers (System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,bool&) <0x0026d>
   at Mono.CSharp.TypeManager.RealMemberLookup (System.Type,System.Type,System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,System.Collections.IList) <0x0012d>
   at Mono.CSharp.TypeManager.MemberLookup (System.Type,System.Type,System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,System.Collections.IList) <0x00022>
   at Mono.CSharp.Expression.MemberLookup (Mono.CSharp.CompilerContext,System.Type,System.Type,System.Type,string,System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.Location) <0x00041>
   at Mono.CSharp.Expression.MemberLookupFinal (Mono.CSharp.ResolveContext,System.Type,System.Type,string,System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.Location) <0x00066>
   at Mono.CSharp.New.DoResolve (Mono.CSharp.ResolveContext) <0x004d5>
   at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext,Mono.CSharp.ResolveFlags) <0x0015b>
   at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext) <0x00015>
   at Mono.CSharp.Assign.DoResolve (Mono.CSharp.ResolveContext) <0x00021>
   at Mono.CSharp.FieldInitializer.DoResolve (Mono.CSharp.ResolveContext) <0x00068>
   at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext,Mono.CSharp.ResolveFlags) <0x0015b>
   at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext) <0x00015>
   at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.BlockContext) <0x00015>
   at Mono.CSharp.TypeContainer.DoResolveFieldInitializers (Mono.CSharp.BlockContext) <0x002ad>
   at Mono.CSharp.TypeContainer.ResolveFieldInitializers (Mono.CSharp.BlockContext) <0x001ac>
   at Mono.CSharp.Constructor.Emit () <0x00138>
   at Mono.CSharp.TypeContainer.EmitConstructors () <0x003a3>
   at Mono.CSharp.TypeContainer.EmitType () <0x0009b>
   at Mono.CSharp.RootContext.EmitCode () <0x000aa>
   at Mono.CSharp.Driver.Compile () <0x00764>
   at Mono.CSharp.Driver.Main (string[]) <0x0008f>
   at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0x00043>
 
 Native stacktrace:
 
     0   mono                                0x002aa630 g_log_set_fatal_mask + 64
     1   mono                                0x002aa733 g_logv + 243
     2   mono                                0x002aa781 g_log + 65
     3   mono                                0x0014d079 mono_class_layout_fields + 2953
     4   mono                                0x0014c3a4 mono_method_set_generic_container + 5044
     5   mono                                0x00154e8d mono_class_init + 1229
     6   mono                                0x00220371 mono_type_get_object + 1473
     7   mono                                0x0018910d mono_domain_lookup_shared_generic + 18429
     8   ???                                 0x00767782 0x0 + 7763842
     9   ???                                 0x00767700 0x0 + 7763712
     10  ???                                 0x00767d38 0x0 + 7765304
     11  ???                                 0x02d3645d 0x0 + 47408221
     12  ???                                 0x043a4aa3 0x0 + 70929059
     13  ???                                 0x043a49fb 0x0 + 70928891
     14  ???                                 0x043a3c1f 0x0 + 70925343
     15  ???                                 0x043a3ae9 0x0 + 70925033
     16  ???                                 0x043a3a4d 0x0 + 70924877
     17  ???                                 0x02f8fd19 0x0 + 49872153
     18  ???                                 0x02f8fb0e 0x0 + 49871630
     19  ???                                 0x02f8f9a4 0x0 + 49871268
     20  ???                                 0x02f8f8a9 0x0 + 49871017
     21  ???                                 0x043c078e 0x0 + 71042958
     22  ???                                 0x043c0166 0x0 + 71041382
     23  ???                                 0x043c0023 0x0 + 71041059
     24  ???                                 0x043bf7da 0x0 + 71038938
     25  ???                                 0x043bf727 0x0 + 71038759
     26  ???                                 0x04445476 0x0 + 71586934
     27  ???                                 0x043ba454 0x0 + 71017556
     28  ???                                 0x043ba26e 0x0 + 71017070
     29  ???                                 0x043ba7b2 0x0 + 71018418
     30  ???                                 0x043ba719 0x0 + 71018265
     31  ???                                 0x043ba454 0x0 + 71017556
     32  ???                                 0x043ba26e 0x0 + 71017070
     33  ???                                 0x043ba1f6 0x0 + 71016950
     34  ???                                 0x043ba0a6 0x0 + 71016614
     35  ???                                 0x043b9dcd 0x0 + 71015885
     36  ???                                 0x043b9051 0x0 + 71012433
     37  ???                                 0x043b8d6c 0x0 + 71011692
     38  ???                                 0x043b6e9c 0x0 + 71003804
     39  ???                                 0x043b68fb 0x0 + 71002363
     40  ???                                 0x007f322d 0x0 + 8335917
     41  ???                                 0x0075b2a8 0x0 + 7713448
     42  ???                                 0x0075b62c 0x0 + 7714348
     43  mono                                0x0000ed62 mono_jit_find_compiled_method + 1538
     44  mono                                0x001fdfaa mono_runtime_invoke + 170
     45  mono                                0x00200257 mono_runtime_exec_main + 663
     46  mono                                0x001ffaec mono_runtime_run_main + 476
     47  mono                                0x0009f48f mono_jit_exec + 239
     48  mono                                0x0009f6e0 mono_jit_exec + 832
     49  mono                                0x000a183e mono_main + 7118
     50  mono                                0x000024b8 main + 56
     51  mono                                0x00002435 start + 53
 
 Debug info from gdb:
 
 
 =================================================================
 Got a SIGSEGV while executing native code. This usually indicates
 a fatal error in the mono runtime or one of the native libraries 
 used by your application.
 =================================================================
 
  
 (Filename:  Line: 0)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dominicmuelelr · Jan 08, 2016 at 05:34 PM 0
Share

This is still not fixed, it was fixed in $$anonymous$$ono 3 but Unity is still on 2.2 or something.

avatar image sbsmith · Feb 03, 2016 at 06:26 PM 0
Share

I just ran into this problem too. I'm using a generic struct as a handle class.

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Jeff-Kesselman · Jun 08, 2014 at 07:06 PM

I hacked around this bug by creating a non generic struct for the SparseGrid that is an int 3 vector, and then writing implicit conversion s to convert to and from the generic the rest of my codebase uses.

But this is really annoying and looks like a compiler bug.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What are the properties of a good key hash? 1 Answer

C# Point structure 1 Answer

Enum instead of numbers in arrays 1 Answer

Change variable in inspector depending on enum using struct 0 Answers

How to save ComputeBuffer? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges