Skip to content

Conversation

@RobertGlobant20
Copy link
Contributor

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

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
@RobertGlobant20 RobertGlobant20 requested review from a team and Copilot December 16, 2025 20:02
Copy link

@github-actions github-actions bot left a 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

Copy link
Contributor

Copilot AI left a 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 HostStartup and SplashScreenStartupContext classes 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;
Copy link

Copilot AI Dec 16, 2025

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.

Suggested change
HostInfo = hostInfo != null? hostInfo:null;
HostInfo = hostInfo != null ? hostInfo : null;

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Dec 16, 2025

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.

Suggested change
static Dynamo.Wpf.UI.HostStartup.Current.get -> Dynamo.Wpf.UI.SplashScreenStartupContext
static Dynamo.Wpf.UI.HostStartup.Current.get -> Dynamo.Wpf.UI.SplashScreenStartupContext?

Copilot uses AI. Check for mistakes.
Comment on lines 65 to 66
return Path.Combine(Current.UserDataFolder,
String.Format("{0}.{1}", version.Major, version.Minor));
Copy link

Copilot AI Dec 16, 2025

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}\"

Copilot uses AI. Check for mistakes.
Comment on lines 73 to 74
return Path.Combine(Path.Combine(folder, Configurations.DynamoAsString, "Dynamo Core"),
String.Format("{0}.{1}", version.Major, version.Minor));
Copy link

Copilot AI Dec 16, 2025

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}\"

Copilot uses AI. Check for mistakes.
@RobertGlobant20
Copy link
Contributor Author

GIF showing that the WebView2 cache folder is only created in the expected folder for DynamoRevit.
xI7mDjEbof

@RobertGlobant20
Copy link
Contributor Author

GIF showing that the Dynamo x.x folder is being created successfully in DynamoSandbox.
explorer_zZjicwCkj2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant