0
Fixed

2.0.0a6 InvalidOperationException: Cannot add alias '_11' to handle '_1' because the handle is not reserved. Consider using Reserve instead.

Ex-Crow 9 months ago updated by Lazlo Bonin (Lead Developer) 8 months ago 3

Seems to be related to this Custom Events issue: https://support.ludiq.io/communities/5/topics/4558-200a6-new-custom-event-issues

EDIT: The error disappears when I delete my new custom events or remove the associated units from the graph.

Full stack trace:

[Exception] InvalidOperationException: Cannot add alias '_11' to handle '_1' because the handle is not reserved. Consider using Reserve instead.
Ludiq.Bolt.AliasedHandlePool`2[TAlias,THandle].Alias() Assets/Ludiq/Bolt.Core/Editor/Generation/AliasedHandlePool.cs:38
36: if (!handles.Contains(handle))
37: {
-->38: throw new InvalidOperationException($"Cannot add alias '{alias}' to handle '{handle}' because the handle is not reserved. Consider using {nameof(Reserve)} instead.");
39: }

Ludiq.Bolt.MethodBaseGeneration`1[TMethod].AliasParameter() Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/MethodBaseGeneration.cs:52
50: {
51: parameterAliases.Add(alias, parameter);
-->52: localIdentifiers.Alias(alias, parameter.name);
53: }

Ludiq.Bolt.MethodBaseGeneration`1[TMethod].DeclareParameter() Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/MethodBaseGeneration.cs:45
43: var parameter = new ParameterGeneration(this, name, generator);
44: _parameters.Add(parameter);
-->45: AliasParameter(identifier, parameter);
46: return parameter;
47: }

ClassEventGenerator.Declare() Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/ClassEventGenerator.cs:38
36: foreach (var parameter in @event.parameters)
37: {
-->38: var invokeParameterGeneration = invokeMethod.DeclareParameter
39: (
40: parameter.Descriptor().title.ToIdentifier().FirstCharacterToLower(),

ClassDefinitionGenerator.Declare() Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/ClassDefinitionGenerator.cs:38
36: foreach (var memberGenerator in memberGenerators)
37: {
-->38: memberGenerator.Declare(classGeneration);
39: }

Ludiq.Bolt.TypeDefinitionGenerator`2[TDefinition,TGeneration].Ludiq.Bolt.IRootTypeGenerator.Declare() Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/TypeDefinitionGenerator.cs:44
42: ITypeGeneration IRootTypeGenerator.Declare(DocumentGeneration document, CodeTypeReference reference)
43: {
-->44: return Declare(document, reference);
45: }
46: }

RootGeneration.DeclareType() Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:59
57: var documentGeneration = documentGenerator.Declare(this, documentName);
-->59: var typeGeneration = typeGenerator.Declare(documentGeneration, typeReference);
61: typeGenerations.Add(typeDefinition, typeGeneration);

RootGeneration.Type() Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:70
68: if (!typeGenerations.TryGetValue(typeDefinition, out var type))
69: {
-->70: type = DeclareType(typeDefinition);
71: }

GenerationWorkflow.Generate() Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:90
88: private static void Generate(RootGeneration rootGeneration, TypeDefinition typeDefinition)
89: {
-->90: var typeGeneration = rootGeneration.Type(typeDefinition);
92: typeDefinition.generatedTypeName = typeGeneration.reference.ToFullName();

GenerationWorkflow+<>c__DisplayClass2_1.b__2() Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:51
49: {
50: assetsGeneration.StartStep(typeDefinition.Descriptor().title);
-->51: Generate(project, typeDefinition);
52: assetsGeneration.CompleteStep();
53: }

Task.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:65
63: public void Run()
64: {
-->65: work(this);
66: }

WindowTaskRunner.RunSynchronous() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:62
60: try
61: {
-->62: task.Run();
63: }
64: catch (ThreadAbortException) { }

Debug.LogException()

WindowTaskRunner.RunSynchronous() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:69
67: catch (Exception ex)
68: {
-->69: Debug.LogException(ex);
70: }
71: finally

WindowTaskRunner.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:45
43: }
-->45: RunSynchronous(task);
46: }
47: }

Task.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:194
192: var task = new Task(runner, title, steps, work);
-->194: runner.Run(task);
195: }
196: }

Ludiq.Bolt.<>c__DisplayClass2_0.b__0() Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:44
42: if (typeDefinitions.Count > 0)
43: {
-->44: Task.Run
45: (
46: "Generating type definitions...", typeDefinitions.Count, assetsGeneration =>

Task.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:65
63: public void Run()
64: {
-->65: work(this);
66: }

WindowTaskRunner.RunSynchronous() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:62
60: try
61: {
-->62: task.Run();
63: }
64: catch (ThreadAbortException) { }

Ludiq.<>c__DisplayClass10_0.b__0() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:34
32: }
-->34: new Thread(() => RunSynchronous(task)).Start();
36: window.ShowModal();

ThreadHelper.ThreadStart()
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


Graph: https://imgur.com/H6NUFFV

So this appears whenever a custom event unit is added to a graph.

[Exception] InvalidOperationException: Cannot add alias '_1010' to handle '_10' because the handle is not reserved. Consider using Reserve instead.
Ludiq.Bolt.AliasedHandlePool`2[TAlias,THandle].Alias() Assets/Ludiq/Bolt.Core/Editor/Generation/AliasedHandlePool.cs:38
36: if (!handles.Contains(handle))
37: {
-->38: throw new InvalidOperationException($"Cannot add alias '{alias}' to handle '{handle}' because the handle is not reserved. Consider using {nameof(Reserve)} instead.");
39: }

Ludiq.Bolt.MethodBaseGeneration`1[TMethod].AliasParameter() Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/MethodBaseGeneration.cs:52
50: {
51: parameterAliases.Add(alias, parameter);
-->52: localIdentifiers.Alias(alias, parameter.name);
53: }

Ludiq.Bolt.MethodBaseGeneration`1[TMethod].DeclareParameter() Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/MethodBaseGeneration.cs:45
43: var parameter = new ParameterGeneration(this, name, generator);
44: _parameters.Add(parameter);
-->45: AliasParameter(identifier, parameter);
46: return parameter;
47: }

ClassEventGenerator.Declare() Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/ClassEventGenerator.cs:38
36: foreach (var parameter in @event.parameters)
37: {
-->38: var invokeParameterGeneration = invokeMethod.DeclareParameter
39: (
40: parameter.Descriptor().title.ToIdentifier().FirstCharacterToLower(),

ClassDefinitionGenerator.Declare() Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/ClassDefinitionGenerator.cs:38
36: foreach (var memberGenerator in memberGenerators)
37: {
-->38: memberGenerator.Declare(classGeneration);
39: }

Ludiq.Bolt.TypeDefinitionGenerator`2[TDefinition,TGeneration].Ludiq.Bolt.IRootTypeGenerator.Declare() Assets/Ludiq/Bolt.Core/Editor/Generation/Generators/TypeDefinitionGenerator.cs:44
42: ITypeGeneration IRootTypeGenerator.Declare(DocumentGeneration document, CodeTypeReference reference)
43: {
-->44: return Declare(document, reference);
45: }
46: }

RootGeneration.DeclareType() Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:59
57: var documentGeneration = documentGenerator.Declare(this, documentName);
-->59: var typeGeneration = typeGenerator.Declare(documentGeneration, typeReference);
61: typeGenerations.Add(typeDefinition, typeGeneration);

RootGeneration.Type() Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/RootGeneration.cs:70
68: if (!typeGenerations.TryGetValue(typeDefinition, out var type))
69: {
-->70: type = DeclareType(typeDefinition);
71: }

GenerationWorkflow.Generate() Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:90
88: private static void Generate(RootGeneration rootGeneration, TypeDefinition typeDefinition)
89: {
-->90: var typeGeneration = rootGeneration.Type(typeDefinition);
92: typeDefinition.generatedTypeName = typeGeneration.reference.ToFullName();

GenerationWorkflow+<>c__DisplayClass2_1.b__2() Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:51
49: {
50: assetsGeneration.StartStep(typeDefinition.Descriptor().title);
-->51: Generate(project, typeDefinition);
52: assetsGeneration.CompleteStep();
53: }

Task.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:65
63: public void Run()
64: {
-->65: work(this);
66: }

WindowTaskRunner.RunSynchronous() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:62
60: try
61: {
-->62: task.Run();
63: }
64: catch (ThreadAbortException) { }

Debug.LogException()

WindowTaskRunner.RunSynchronous() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:69
67: catch (Exception ex)
68: {
-->69: Debug.LogException(ex);
70: }
71: finally

WindowTaskRunner.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:45
43: }
-->45: RunSynchronous(task);
46: }
47: }

Task.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:194
192: var task = new Task(runner, title, steps, work);
-->194: runner.Run(task);
195: }
196: }

Ludiq.Bolt.<>c__DisplayClass2_0.b__0() Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:44
42: if (typeDefinitions.Count > 0)
43: {
-->44: Task.Run
45: (
46: "Generating type definitions...", typeDefinitions.Count, assetsGeneration =>

Task.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:65
63: public void Run()
64: {
-->65: work(this);
66: }

WindowTaskRunner.RunSynchronous() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:62
60: try
61: {
-->62: task.Run();
63: }
64: catch (ThreadAbortException) { }

Ludiq.<>c__DisplayClass10_0.b__0() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:34
32: }
-->34: new Thread(() => RunSynchronous(task)).Start();
36: window.ShowModal();

ThreadHelper.ThreadStart()

Fixed (Unreleased)

Hi TowerCrow,

Thanks for the report. I can't reproduce this in my current working copy, but I believe I fixed it by fixing another issue with the way local identifiers were reserved in the code generation. I'll mark as Fixed for now, let me know if you see it happen again the next version.