-
Notifications
You must be signed in to change notification settings - Fork 666
DYN-9958 WebView2 cache folder location #16787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
DYN-9958 WebView2 cache folder location #16787
Conversation
Modifying the SplashScreen Constructor passing the HostInfo so we can know where to create the WebView2 folder
I've added new new clases HostStartup and SplashScreenStartupContext, this will be used for setting host information (in this case Revit), with this info now the the UserDirectory used for WebView2 cache will be change depending if we are using DynamoSandbox or DynamoRevit. Finally I've updated the PublicAPI to reflect the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9958
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where Dynamo on Revit incorrectly creates a WebView2 cache folder in the "Dynamo Core" directory instead of the host-specific directory. The solution introduces a new startup context pattern that allows hosts like DynamoRevit to specify their user data folder location.
Key changes:
- Introduced
HostStartupandSplashScreenStartupContextclasses to manage host-specific initialization - Centralized WebView2 cache directory resolution through
HostStartup.GetUserDirectory() - Updated splash screen to accept and utilize startup context information
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/DynamoCoreWpf/UI/HostStartup.cs | New static class providing centralized user directory resolution with host context awareness |
| src/DynamoCoreWpf/UI/SplashScreenStartupContext.cs | New class encapsulating host startup information including analytics and user data folder path |
| src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs | Added constructor accepting startup context and delegated directory resolution to HostStartup |
| src/DynamoCoreWpf/Views/PackageManager/Components/PackageManagerWizard/PackageManagerWizard.xaml.cs | Replaced local directory resolution with centralized HostStartup.GetUserDirectory() call |
| src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs | Replaced local directory resolution with centralized HostStartup.GetUserDirectory() call |
| src/DynamoCoreWpf/PublicAPI.Unshipped.txt | Added new public APIs for HostStartup and SplashScreenStartupContext |
| src/DynamoCoreWpf/DynamoCoreWpf.csproj | Registered new source files in project |
| /// <param name="userDataFolder">The path to the user data folder. If <see langword="null"/>, an empty string is used.</param> | ||
| public SplashScreenStartupContext(HostAnalyticsInfo ?hostInfo, string userDataFolder) | ||
| { | ||
| HostInfo = hostInfo != null? hostInfo:null; |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing spaces around the ternary operator. Should be hostInfo != null ? hostInfo : null for consistency with C# formatting conventions.
| HostInfo = hostInfo != null? hostInfo:null; | |
| HostInfo = hostInfo != null ? hostInfo : null; |
| Dynamo.Wpf.UI.GuidedTour.Welcome | ||
| Dynamo.Wpf.UI.GuidedTour.Welcome.Welcome(Dynamo.Wpf.UI.GuidedTour.HostControlInfo host, double width, double height) -> void | ||
| Dynamo.Wpf.UI.HostStartup | ||
| static Dynamo.Wpf.UI.HostStartup.Current.get -> Dynamo.Wpf.UI.SplashScreenStartupContext |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Current property should be nullable (SplashScreenStartupContext?) to match the actual implementation in HostStartup.cs where it's declared as SplashScreenStartupContext? Current.
| static Dynamo.Wpf.UI.HostStartup.Current.get -> Dynamo.Wpf.UI.SplashScreenStartupContext | |
| static Dynamo.Wpf.UI.HostStartup.Current.get -> Dynamo.Wpf.UI.SplashScreenStartupContext? |
src/DynamoCoreWpf/UI/HostStartup.cs
Outdated
| return Path.Combine(Current.UserDataFolder, | ||
| String.Format("{0}.{1}", version.Major, version.Minor)); |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use string interpolation instead of String.Format for better readability: $\"{version.Major}.{version.Minor}\"
src/DynamoCoreWpf/UI/HostStartup.cs
Outdated
| return Path.Combine(Path.Combine(folder, Configurations.DynamoAsString, "Dynamo Core"), | ||
| String.Format("{0}.{1}", version.Major, version.Minor)); |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use string interpolation instead of String.Format for better readability: $\"{version.Major}.{version.Minor}\"
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
string interpolation instead of String.Format for better readability


Purpose
Fixing problem of Dynamo on Revit creating the Dynamo x.x folder in C:\Users<user>\AppData\Roaming\Dynamo\Dynamo Core for WebView2 cache content. (it should be created only in Dynamo Revit folder)
I've added new new clases HostStartup and SplashScreenStartupContext, this will be used for setting host information (in this case Revit), with this info now the the UserDirectory used for WebView2 cache will be change depending if we are using DynamoSandbox or DynamoRevit.
Finally I've updated the PublicAPI to reflect the changes
Declarations
Check these if you believe they are true
Release Notes
Fixing problem of Dynamo on Revit creating the Dynamo x.x folder in C:\Users<user>\AppData\Roaming\Dynamo\Dynamo Core for WebView2 cache content. (it should be created only in Dynamo Revit folder)
Reviewers
@DynamoDS/eidos
FYIs