0
Not a Bug

2.0.0a6 [Exception] InvalidOperationException: Type System.Collections.Generic.IComparer`1[T] contains generic parameters.

Ex-Crow 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 2



[Exception] InvalidOperationException: Type System.Collections.Generic.IComparer`1[T] contains generic parameters.
TypeUtility.EnsureCloseConstructed()    Assets/Ludiq/Ludiq.Core/Runtime/Reflection/TypeUtility.cs:1038
1036:       if (type.ContainsGenericParameters)
1037:       {
-->1038:           throw new InvalidOperationException($"Type {type} contains generic parameters.");
1039:       }
1040:   }
ClassVariableGenerator.GenerateProperty()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/ClassVariableGenerator.cs:58
56:   if (variable.type.isCompiled)
57:   {
-->58:       variable.type.compiled.EnsureCloseConstructed();
59:   }
PropertyGeneration.GenerateDeclaration()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/PropertyGeneration.cs:18
16:   public override CodePropertyMember GenerateDeclaration()
17:   {
-->18:       return generator(this);
19:   }
Ludiq.Bolt.MemberGeneration`1[TDeclaration].Ludiq.Bolt.IMemberGeneration.GenerateDeclaration()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/MemberGeneration.cs:32
30:   public abstract TDeclaration GenerateDeclaration();
-->32:   CodeCompositeMember IMemberGeneration.GenerateDeclaration() => GenerateDeclaration();
34:   #region Self
Ludiq.Bolt.CompositeGeneration`1+<>c[TDeclaration].b__26_0()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/CompositeGeneration.cs:162
160:       public IEnumerable GenerateMembers()
161:       {
-->162:           return members.Select(m => m.GenerateDeclaration());
163:       }
164:   }
System.Linq.Enumerable+SelectIListIterator`2[TSource,TResult].MoveNext()    <351e49e2a5bf4fd6beabb458ce2255f3>:0
System.Collections.Generic.List`1[T].InsertRange()    <567df3e0919241ba98db88bec4c6696f>:0
System.Collections.Generic.List`1[T].AddRange()    <567df3e0919241ba98db88bec4c6696f>:0
ClassDefinitionGenerator.GenerateDeclaration()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/ClassDefinitionGenerator.cs:73
71:   }
-->73:   classDeclaration.Members.AddRange(classGeneration.GenerateMembers());
75:   return classDeclaration;
ClassGeneration.GenerateDeclaration()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/ClassGeneration.cs:25
23:   public override CodeClassDeclaration GenerateDeclaration()
24:   {
-->25:       return generator(this);
26:   }
Ludiq.Bolt.TypeGeneration`1[TDeclaration].Ludiq.Bolt.ITypeGeneration.GenerateDeclaration()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/TypeGeneration.cs:11
9:   public override DocumentGeneration document => _document ?? base.document;
-->11:   CodeTypeDeclaration ITypeGeneration.GenerateDeclaration() => GenerateDeclaration();
13:   public CodeTypeReference reference { get; }
DocumentGenerator.Generate()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/DocumentGenerator.cs:62
60:   var typeGeneration = typeDefinition.Generation(generation);
61:   var typeReference = typeGeneration.GenerateReference();
-->62:   var typeDeclaration = typeGeneration.GenerateDeclaration();
64:   // Add the usings required during the type's generation
DocumentGeneration.Generate()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/DocumentGeneration.cs:33
31:   public CodeDocument Generate()
32:   {
-->33:       return generator(this);
34:   }
RootGeneration.Write()    Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:101
99:   foreach (var typeGeneration in typeGenerations.Values.ToArray())
100:   {
-->101:       documents.Add(typeGeneration.document, typeGeneration.document.Generate());
102:   }
CodePreviewWindow.Generate()    Assets/Ludiq/Bolt.Core/Editor/Generation/CodePreviewWindow.cs:430
428:   var writerSystem = new TokenCodeWriterSystem();
429:   var typeGeneration = projectGeneration.Type(typeDefinition);
-->430:   projectGeneration.Write(writerSystem);
431:   var tokens = writerSystem.GetTokens(typeGeneration.document.name);
432:   var tokensByElements = writerSystem.GetTokensByElements(typeGeneration.document.name);
Debug.LogException()
CodePreviewWindow.OnFailureGUI()    Assets/Ludiq/Bolt.Core/Editor/Generation/CodePreviewWindow.cs:399
397:       else
398:       {
-->399:           Debug.LogException(failure);
400:       }
401:   }
CodePreviewWindow.OnGUI()    Assets/Ludiq/Bolt.Core/Editor/Generation/CodePreviewWindow.cs:292
290:   if (failure != null)
291:   {
-->292:       OnFailureGUI();
293:   }
GUIUtility.ProcessEvent()    C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179
Bolt Version:
2.0.0a6
Unity Version:
2019.2.15
Platform(s):
PC
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2

Hello TowerCrow,

Thanks for reporting this to us we really appreciate it. Forwarding this to our lead developer. 

Best,

Hasan from Ludiq

Not a Bug

Hi TowerCrow,

That sounds like you're trying to create an IComparable<T> class variable without specifying T. That's not valid in Bolt because it's not valid in C#. Class properties cannot be open constructed generics.

I'll improve the error message for clarity in the next version.

If I misunderstood the issue, please comment again and let me know.