You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user opens a .dyn file from an untrusted folder, the "untrusted location" warning popup does not appear until after the entire graph has finished loading. On large graphs this is 20+ seconds. The popup should appear immediately, before the heavy deserialization work begins.
Regression from Dynamo 3.5 → 3.6. The popup-after-load ordering existed in 3.5 too, but graph open was fast enough that the delay was imperceptible. 3.6 perf refactors made other parts of open faster but did not move the popup display, so the gap grew visible.
Tracked in Jira: DYN-9151.
Reproduction
Add a folder to Preferences → Security → Trusted Locations and then remove it (or use any folder not on the trusted list).
Place a large .dyn file (≥1000 nodes, or any graph that takes >5s to open) in that untrusted folder.
File → Open the graph.
Observed: App processes for 20+ seconds. UI is laggy. Only after deserialization completes does the trust warning popup appear.
Expected: Popup appears within ~100ms of clicking Open, before deserialization runs.
Root cause
In src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs, method Open(object parameters) (~L2192-2287) executes in this order:
ExecuteCommand(new DynamoModel.OpenFileCommand(...)) — synchronous on UI thread; routes through DynamoModel.OpenFileFromPath → OpenJsonFileFromPath → OpenJsonFile + OpenWorkspace + OnComputeModelDeserialized + SetPeriodicEvaluation
20+ s on large graphs
L2237
RefreshAnnotationDescriptions()
slow
L2240-2247
FileTrustViewModel.ShowWarningPopup = true — this is what flips IsOpen on the WPF popup
popup finally appears here
The trust check itself is not the bottleneck. The defect is ordering: the popup is set after ExecuteCommand returns.
Same wrong-order pattern is duplicated in Insert(object parameters) at L2297-2371.
Prior attempt
PR #16947 ("DYN-9151: Add null-safety and caching") tried to defer ExecuteCommand via UIDispatcher.BeginInvoke so the popup could render first. The deferral was reverted — likely because the currentWorkspaceViewModel?.IsHomeSpace guard at L2240 fails: the new home workspace isn't swapped in until ExecuteCommand completes, so the guard skips showing the popup. Read the review comments on #16947 before re-attempting.
Acceptance criteria
Opening a large graph (≥1000 nodes) from an untrusted folder shows the trust warning popup within 500 ms of the user clicking Open.
After the graph finishes loading, the popup state is correct: visible if the folder is still untrusted, hidden if the user added it to trusted locations mid-load.
Same fix applied to DynamoViewModel.Insert (L2297-2371).
No regression to the .dyf exclusion (custom node definitions should not trigger the popup).
Existing tests pass; add a regression test that asserts popup-show ordering relative to OpenFileCommand execution.
Move the FileTrustViewModel block from L2240-2247 to before L2234's ExecuteCommand call. To avoid the regression that killed #16947, drop reliance on currentWorkspaceViewModel?.IsHomeSpace (the new workspace isn't loaded yet at this point) and either:
Option A (preferred): Show popup pre-emptively keyed on the file path. After load completes, call the existing ShowHideFileTrustWarningIfCurrentWorkspaceTrusted at L4200 to reconcile (hide popup if the loaded workspace turned out to be trusted, e.g., a custom node def or the user mid-load whitelisted the folder).
Option B: Guard on file extension only (already excludes .dyf) + null check on FileTrustViewModel. Drop the IsHomeSpace guard.
Secondary fixes:
src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.csInsert (L2297-2371) — duplicate of the bug, apply the same fix.
src/DynamoCoreWpf/Views/FileTrust/FileTrustWarning.xaml.cs (L71-87) — ViewModel_PropertyChanged calls mainWindow.Dispatcher.Invoke(DispatcherPriority.Background, ...). If the popup is moved earlier (before heavy work), this synchronous pump may need to be BeginInvoke to avoid re-blocking the UI thread during the popup-render → ExecuteCommand transition.
Optional cleanup (in the same area):
src/DynamoCore/Configuration/PreferenceSettings.cs L637-639: TrustedLocations getter calls .ToList() on every access. L1466 IsTrustedLocation iterates that copied list per entry. Not the bottleneck, but trivial to fix while in the file.
Files to read first
src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs — Open (~L2192), Insert (~L2297), ShowHideFileTrustWarningIfCurrentWorkspaceTrusted (~L4200)
src/DynamoCore/Models/DynamoModel.cs — OpenFileFromPath (~L2175), OpenJsonFileFromPath (~L2304) for context on what runs synchronously inside ExecuteCommand
Problem
When a user opens a
.dynfile from an untrusted folder, the "untrusted location" warning popup does not appear until after the entire graph has finished loading. On large graphs this is 20+ seconds. The popup should appear immediately, before the heavy deserialization work begins.Regression from Dynamo 3.5 → 3.6. The popup-after-load ordering existed in 3.5 too, but graph open was fast enough that the delay was imperceptible. 3.6 perf refactors made other parts of open faster but did not move the popup display, so the gap grew visible.
Tracked in Jira: DYN-9151.
Reproduction
Preferences → Security → Trusted Locationsand then remove it (or use any folder not on the trusted list)..dynfile (≥1000 nodes, or any graph that takes >5s to open) in that untrusted folder.File → Openthe graph.Root cause
In
src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs, methodOpen(object parameters)(~L2192-2287) executes in this order:Path.GetDirectoryName(filePath)displayTrustWarning = !PreferenceSettings.IsTrustedLocation(directoryName) && ...RunSettings.ForceBlockRun = displayTrustWarning;ExecuteCommand(new DynamoModel.OpenFileCommand(...))— synchronous on UI thread; routes throughDynamoModel.OpenFileFromPath→OpenJsonFileFromPath→OpenJsonFile+OpenWorkspace+OnComputeModelDeserialized+SetPeriodicEvaluationRefreshAnnotationDescriptions()FileTrustViewModel.ShowWarningPopup = true— this is what flipsIsOpenon the WPF popupThe trust check itself is not the bottleneck. The defect is ordering: the popup is set after
ExecuteCommandreturns.Same wrong-order pattern is duplicated in
Insert(object parameters)at L2297-2371.Prior attempt
PR #16947 ("DYN-9151: Add null-safety and caching") tried to defer
ExecuteCommandviaUIDispatcher.BeginInvokeso the popup could render first. The deferral was reverted — likely because thecurrentWorkspaceViewModel?.IsHomeSpaceguard at L2240 fails: the new home workspace isn't swapped in untilExecuteCommandcompletes, so the guard skips showing the popup. Read the review comments on #16947 before re-attempting.Acceptance criteria
DynamoViewModel.Insert(L2297-2371)..dyfexclusion (custom node definitions should not trigger the popup).OpenFileCommandexecution.Suggested implementation
Primary fix —
src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.csOpen(L2192-2287):Move the
FileTrustViewModelblock from L2240-2247 to before L2234'sExecuteCommandcall. To avoid the regression that killed #16947, drop reliance oncurrentWorkspaceViewModel?.IsHomeSpace(the new workspace isn't loaded yet at this point) and either:ShowHideFileTrustWarningIfCurrentWorkspaceTrustedat L4200 to reconcile (hide popup if the loaded workspace turned out to be trusted, e.g., a custom node def or the user mid-load whitelisted the folder)..dyf) + null check onFileTrustViewModel. Drop theIsHomeSpaceguard.Secondary fixes:
src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.csInsert(L2297-2371) — duplicate of the bug, apply the same fix.src/DynamoCoreWpf/Views/FileTrust/FileTrustWarning.xaml.cs(L71-87) —ViewModel_PropertyChangedcallsmainWindow.Dispatcher.Invoke(DispatcherPriority.Background, ...). If the popup is moved earlier (before heavy work), this synchronous pump may need to beBeginInvoketo avoid re-blocking the UI thread during the popup-render → ExecuteCommand transition.Optional cleanup (in the same area):
src/DynamoCore/Configuration/PreferenceSettings.csL637-639:TrustedLocationsgetter calls.ToList()on every access. L1466IsTrustedLocationiterates that copied list per entry. Not the bottleneck, but trivial to fix while in the file.Files to read first
src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs—Open(~L2192),Insert(~L2297),ShowHideFileTrustWarningIfCurrentWorkspaceTrusted(~L4200)src/DynamoCoreWpf/Views/FileTrust/FileTrustWarning.xaml.cs—ViewModel_PropertyChanged(~L71)src/DynamoCoreWpf/ViewModels/FileTrust/FileTrustWarningViewModel.cs—ShowWarningPopupsettersrc/DynamoCoreWpf/Views/FileTrust/FileTrustWarning.xaml— popupIsOpenbindingsrc/DynamoCore/Models/DynamoModel.cs—OpenFileFromPath(~L2175),OpenJsonFileFromPath(~L2304) for context on what runs synchronously insideExecuteCommandOut of scope
OpenFileCommanditself async — separate, larger effort.TrustedLocationsstorage. (Trivial getter cleanup OK; full refactor is out.)Notes
Line numbers are approximate to current
masteras of this writing.