fix: resolve C# loader regressions (#3108, #3107, #3140, version-info) #3188
fix: resolve C# loader regressions (#3108, #3107, #3140, version-info) #3188
Conversation
|
Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔 |
db0b7a6 to
0e8830b
Compare
0e8830b to
60982e0
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses several regressions in the C# loader path of pyRevit’s Revit add-in, aiming to restore legacy loader behavior for startup ordering, identifier generation, duplicate type handling, and Revit version filtering.
Changes:
- Reintroduces multi-pass session loading so all extension assemblies load before any startup scripts execute.
- Hardens identifier/class-name sanitization (including leading-digit handling) across parser, generators, and UI builders.
- Adds Revit-year propagation into extension parsing for min/max version gating, and introduces a duplicate class-name guard in Roslyn code generation.
Reviewed changes
Copilot reviewed 10 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| dev/pyRevitLoader/pyRevitExtensionParserTester/ParsedBundleTests.cs | Updates test sanitizer to match production leading-digit behavior. |
| dev/pyRevitLoader/pyRevitExtensionParserTester/ComponentValidationTests.cs | Tightens UniqueId validity rules in tests (disallow leading digits). |
| dev/pyRevitLoader/pyRevitExtensionParser/ParsedExtension.cs | Adds RocketModeCompatible flag on parsed extensions. |
| dev/pyRevitLoader/pyRevitExtensionParser/ExtensionParser.cs | Adds Revit version compatibility checks and passes revitYear through parsing; updates UniqueId sanitization logic. |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/SessionManagerService.cs | Restores multi-pass load order: build/load assemblies → run startup scripts → build UI. |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/Buttons/ButtonBuilderBase.cs | Ensures generated command class identifiers never start with a digit. |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/Builders/StackBuilder.cs | Aligns stack builder class-name sanitization with leading-digit fix. |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/SessionManager/ServiceFactory.cs | Parses/passes Revit year into ExtensionManagerService for version filtering. |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/SessionManager/ExtensionManagerService.cs | Uses revitYear when parsing installed extensions (cached). |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/AssemblyMaker/CommandTypeGenerator.cs | Adds duplicate class-name guard; updates engine-config generation behavior and identifier sanitization. |
dev/pyRevitLoader/pyRevitAssemblyBuilder/AssemblyMaker/CommandTypeGenerator.cs
Show resolved
Hide resolved
dev/pyRevitLoader/pyRevitAssemblyBuilder/AssemblyMaker/CommandTypeGenerator.cs
Show resolved
Hide resolved
Addresses Copilot review: avoid misleading 'skipped' log messages and log spam when Revit version is unknown (revitYear <= 0).
|
@devloai If you are available , review my responses to copilot AI |
|
Unable to trigger custom agent "PR Assistant". You have run out of credits 😔 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 26 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
dev/pyRevitLoader/pyRevitExtensionParser/ParsedExtension.cs:23
ParsedExtensionnow declaresRocketModeCompatibletwice (one auto-property at line 19 and another at lines 21-27 with default initializer). This will not compile due to duplicate member names. Remove one of the properties (and keep the XML doc + default initializer on the remaining one if needed).
public bool RocketModeCompatible { get; set; }
/// <summary>
/// Gets or sets whether this extension is compatible with rocket mode.
/// When rocket mode is enabled and the extension is compatible, the engine
dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/SessionManagerService.cs
Show resolved
Hide resolved
dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/SessionManagerService.cs
Show resolved
Hide resolved
dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/SessionManagerService.cs
Show resolved
Hide resolved
…ptions - Remove duplicate RocketModeCompatible declaration (already in develop) - Log ex.ToString() instead of ex.Message in SessionManagerService catch blocks
|
@jmcouffin can you request another round of review by copilot? I think I covered all of its comments but just to make sure, I tested the DLLs locally and looks good here. |
dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/SessionManagerService.cs
Show resolved
Hide resolved
dev/pyRevitLoader/pyRevitAssemblyBuilder/SessionManager/ExtensionManagerService.cs
Outdated
Show resolved
Hide resolved
|
@romangolev can you take a look? |
|
@tay0thman @jmcouffin works well in Revit 2025 ^_^ |
|
@tay0thman blessing from Roman! |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26086+2004-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26088+1318-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26089+1231-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+0549-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1533-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1536-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1556-wip |
|
📦 New public release are available for 6.2.0.26090+1754 |
resolve C# loader regressions
Description
[Bug]: Startup scripts fail in 6.1 #3108: Restore multi-pass loop in SessionManagerService.LoadSession() so all assemblies load before any startup script runs. Fixes cross-extension imports in startup scripts.
[Bug]: Extension folder can't start with a number #3107: Prefix underscore when SanitizeClassName() produces a name starting with a digit (invalid C# identifier). Applied in ExtensionParser, CommandTypeGenerator, ButtonBuilderBase, StackBuilder.
[Bug]:ERROR [pyrevit.loader.sessionmgr] #3140: Add HashSet dedup guard in CommandTypeGenerator.GenerateExtensionCode() to skip duplicate class names instead of emitting CS0101 Roslyn errors.
Version info: Pass revitYear through ExtensionManagerService to ExtensionParser.ParseInstalledExtensions() so min/max version filtering works correctly. Previously defaulted to 0 (unknown).
Checklist
Before submitting your pull request, ensure the following requirements are met:
Related Issues
If applicable, link the issues resolved by this pull request:
Additional Notes
Tested on Revit 2026 (netcore) and 2024(netfx)
Thank you for contributing to pyRevit! 🎉