fix(revit): prevent null reference when extracting workset properties from linked model elements #1052
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixed a
NullReferenceException
inClassPropertiesExtractor.ExtractElementProperties()
that occurred when exporting rooms from linked Revit files. The bug happened because the code was trying to look up worksets from linked model elements using the main document's workset table instead of the element's own document.The fix ensures we use
element.Document.GetWorksetTable()
instead of_converterSettings.Current.Document.GetWorksetTable()
and adds proper error handling for edge cases.Fixes CNX-2414.
User Value
Users can now successfully export rooms from linked files without getting "Revit Operation Failed" errors.
Changes:
ExtractElementProperties()
to use element's own document for workset lookupsScreenshots:
Before: Users got "Revit Operation Failed" with stack trace
After: Export completes successfully with proper workset names (or "Unknown Workset" fallback) -> model
Validation of changes:
Checklist: