Skip to content

Conversation

bjoernsteinhagen
Copy link
Contributor

@bjoernsteinhagen bjoernsteinhagen commented Aug 27, 2025

Description

Fixed a NullReferenceException in ClassPropertiesExtractor.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:

  • Updated ExtractElementProperties() to use element's own document for workset lookups
  • Added try-catch block with fallback to "Unknown Workset" if workset lookup fails
  • Prevents cross-document workset reference errors in linked model scenarios

Screenshots:

Before: Users got "Revit Operation Failed" with stack trace

image

After: Export completes successfully with proper workset names (or "Unknown Workset" fallback) -> model

Validation of changes:

  • Tested with linked models containing rooms with worksets
  • Verified that main model room exports still work correctly

Checklist:

  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

Copy link

linear bot commented Aug 27, 2025

Copy link

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.06%. Comparing base (678f113) to head (254b3bf).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1052   +/-   ##
=======================================
  Coverage   41.06%   41.06%           
=======================================
  Files         109      109           
  Lines        3090     3090           
  Branches      295      295           
=======================================
  Hits         1269     1269           
  Misses       1775     1775           
  Partials       46       46           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bjoernsteinhagen bjoernsteinhagen merged commit edb022f into dev Aug 27, 2025
5 checks passed
@bjoernsteinhagen bjoernsteinhagen deleted the bjorn/cnx-2414-revit-operation-failed-on-linked-rooms branch August 27, 2025 09:44
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.

2 participants