Skip to content

[WIP] DYN-10601 Fix Background 3D Preview export crash on large graphs#17160

Closed
johnpierson wants to merge 5 commits into
DynamoDS:masterfrom
johnpierson:DYN-10601-fix-background-3d-export-crash
Closed

[WIP] DYN-10601 Fix Background 3D Preview export crash on large graphs#17160
johnpierson wants to merge 5 commits into
DynamoDS:masterfrom
johnpierson:DYN-10601-fix-background-3d-export-crash

Conversation

@johnpierson

Copy link
Copy Markdown
Member

Purpose

DYN-10601: Fix Dynamo crashing when exporting the Background 3D Preview as an image on complex graphs (e.g. Manekin-0.50). Related to DYN-10596.

The export path introduced during the Helix upgrade allocated two full-resolution bitmaps per export: RenderBitmap() (discarded after reading dimensions) plus a second RenderTargetBitmap.Render() pass. On large graphs and high-DPI displays this could exhaust memory and crash Dynamo/Revit.

Key changes:

  • Add Watch3DImageExporter to capture the viewport via a single RenderBitmap() call and save directly to PNG
  • Cap export resolution at 4096px on the longest edge to limit memory use on large viewports
  • Reject export when Background 3D Preview is inactive, with a user-facing message
  • Catch OutOfMemoryException and other failures and show a toast instead of crashing
  • Add regression tests in BackgroundPreviewExportTests
  • Reuse the shared exporter from existing Helix image comparison tests

Declarations

Release Notes

Fixed a crash when exporting the Background 3D Preview as an image on graphs with large amounts of geometry.

Reviewers

(FILL ME IN)

FYIs

Manual validation with the Manekin-0.50 graph from DYN-10601 is recommended before merge.

Test plan

  • Load Manekin-0.50 New.dyn, wait for geometry to settle, export Background 3D Preview — no crash, PNG saved
  • Verify export on a small graph (e.g. spherecolors.dyn) still produces a valid image
  • Verify export is blocked with a message when Background 3D Preview is inactive
  • Run dotnet test test/VisualizationTests/WpfVisualizationTests.csproj --filter Name~BackgroundPreviewExport

Replace the redundant double-bitmap export path with a single RenderBitmap capture, cap export resolution, and handle failures gracefully instead of crashing Dynamo.

Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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-10601

@johnpierson johnpierson changed the title DYN-10601 Fix Background 3D Preview export crash on large graphs [WIP] DYN-10601 Fix Background 3D Preview export crash on large graphs Jun 11, 2026
Measure workspace export bounds before creating the RenderTargetBitmap so oversized graphs are rejected without allocating an unsafe bitmap. Restore the workspace transform after rendering and add a UI regression test that verifies oversized workspace exports are refused without writing a file.
Keep Background 3D Preview export failures quiet while preserving failure state and logging. The oversized workspace export warning remains limited to workspace image export.
Route explicit Background 3D Preview image exports directly to the save flow so large workspace bounds do not trigger the nodes-too-far-apart warning. Keep workspace validation in place for workspace image exports.
Capture the current 3D preview before applying the export size cap so Helix does not render from a just-resized, empty back buffer on large graph exports.

Add a regression test that forces scaled background preview export and verifies the PNG contains varied image data instead of only checking that a file was written.
@sonarqubecloud

Copy link
Copy Markdown

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