Skip to content

Fix compiler crash when reporting a call to an abstract shader method - #3413

Merged
xen2 merged 1 commit into
stride3d:masterfrom
vvvv:fix/abstract-method-call-crash
Sep 10, 2026
Merged

xen2 merged 1 commit into
stride3d:masterfrom
vvvv:fix/abstract-method-call-crash

Conversation

@azeno

@azeno azeno commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

PR Details

Fixes a KeyNotFoundException crash in ShaderMixer when a shader calls an abstract method.

Abstract methods have their whole function body (including OpName) erased before the call-site check runs, so context.Names[functionId] throws instead of raising the intended InvalidOperationException. Now uses methodGroupEntry.Name, which is captured earlier and never erased.

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

When a method is abstract, ShaderMixer erases its whole function body (including its OpFunction/OpName), removing its entry from context.Names. The member-access resolution code later detected calls to abstract methods and tried to build the error message using context.Names[functionId], which threw KeyNotFoundException instead of producing the intended InvalidOperationException, crashing the compiler.

Use methodGroupEntry.Name instead, which is captured when the method is first registered (before the abstract method body is erased) and is never removed. Applied the same fix to two other nearby error messages in the same code path that had the identical latent issue.
@xen2
xen2 merged commit 0e55e7b into stride3d:master Sep 10, 2026
33 checks passed
@azeno
azeno deleted the fix/abstract-method-call-crash branch September 11, 2026 13:05
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