Forum

CreateDefault(Null) breaking my patch in 2022.5.0-0200 (works with earlier Gamma version 2022.5.0-0175)

Hi, my patch breaks with Gamma 2022.5.0-0200 and every preview after 2022.5.0-0175.
The trigger seems to be a CreateDefault operation I make for the StateX class. Its fill with a Null, which unfortunately is necessary for the project to work. I don’t have this issue with the StateGraph class that also has a CreateDefault .The error is

System.ArgumentException: Not generic (Parameter 'unspecialized')
   at VL.Lang.Symbols.NodeDefinitionExtensions.Instantiate(INodeDefinitionSymbol unspecialized, IEnumerable`1 typeArguments)
   at VL.Lang.Symbols.ConcreteTypeInstanceSymbol.Instantiate(IOperationDefinitionSymbol operation)
   at VL.Lang.Symbols.Resolver.<GetCreateDefault>g__Resolve|28_0(ITypeSymbol type)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at VL.Lang.Symbols.PatchSymbol.<InsertCreateDefaultNodes>g__CreateCreateDefaultNode|54_3(ITypeSymbol type, Boolean skip, <>c__DisplayClass54_0& )
   at VL.Lang.Symbols.PatchSymbol.<InsertCreateDefaultNodes>g__InsertCreateDefaultForHub|54_1(PatchedDataHubSymbol hub, <>c__DisplayClass54_0& )
   at VL.Lang.Symbols.PatchSymbol.InsertCreateDefaultNodes(Resolver resolver, PatchSymbol patch)
   at VL.Lang.Symbols.PreCompilation.<>c__DisplayClass19_0.<Initialize>g__CompilePatch|2(BuildItem item)
   at VL.Lang.Symbols.PreCompilation.<>c__DisplayClass19_0.<Initialize>g__DoCompile|22(<>c__DisplayClass19_2& )
   at VL.Lang.Symbols.PreCompilation.<>c__DisplayClass19_0.<Initialize>g__CompileBlob|1(IEnumerable`1 blob, Boolean isRecursive)
   at VL.Lang.Symbols.PreCompilation.Initialize(PreCompilation previousCompilation, CancellationToken token, IProgress`1 progress)
   at VL.Lang.Symbols.PreCompilation.Create(Solution solution, PreCompilation previous, CompileOptions options, CancellationToken token, IProgress`1 progress)
   at VL.Lang.Symbols.PreCompilation.WithSolution(Solution value, CompileOptions options, CancellationToken token, IProgress`1 progress)
   at VL.Lang.Symbols.PreCompilation.WithSolution(Solution value, CompileOptions options, CancellationToken token, IProgress`1 progress)
   at VL.Model.VLSession.<>c__DisplayClass191_0.<PrepareSolutionWithFreshSymbolsAsync>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at VL.Model.VLSession.PrepareSolutionWithFreshSymbolsAsync(Solution solution, CompileOptions options, CancellationToken token, IProgress`1 progress, Boolean incremental)
   at VL.Model.VLSession.UpdateCompilationAsync(Solution solution, CompileOptions options, CancellationToken token, IProgress`1 progress, Boolean incremental)
   at VL.Model.VLSession.UpdateCompilationAsync(Solution solution, CompileOptions options, CancellationToken token, IProgress`1 progress, Boolean incremental)
   at VL.Model.VLSession.UpdateCompilationAsync(Solution solution, CompileOptions options, IProgress`1 progress, Boolean incremental)
   at VL.Model.VLSession.UpdateAsync(Solution solution, SolutionUpdateKind kind, Canvas canvas, IProgress`1 progress)
   at VL.Model.ModelExtensions.<>c__DisplayClass23_0.<<RestoreAndMakeCurrent>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at VL.Model.VLSession.<>c__DisplayClass183_0.<<RunAndForget>b__0>d.MoveNext()

Patch here
EarlyStateVL5.3.vl (186.9 KB)

Thanks and best wishes,
H

hello @Hadasi, I will be speculating a bit, but since 2022.5 is basically using the NET 6 and you are setting the null(S) in the constructor, could be related to this ?

@nissidis thanks for the reply. I’m not sure if this is related either, but I think its something the devs will need to fix since this error wasn’t in an earlier version of 22.5. It could have something to do with the way the class has been constructed but from a user’s point of view I don’t think I did anything particularly weird. The patch is little complicated in that it tries to keep the subtypes of the class across the properties, which required me to use constrain types, (and that experience may want another discussion) but the logic has worked on 2021.4.10 versions of gamma too.

Further info, when trying to set the output type of CreateDefault I get this message (specifically when I try to set the type to StateX<*>):

image

Thanks for the report. A fix is on its way!

1 Like

Latest build should work for you!

1 Like