Skip to content

Add [MethodImpl(NoInlining)] to methods using GetCallingAssembly#29

Merged
Shane32 merged 1 commit into
masterfrom
copilot/mark-getcallingassembly-methods
May 24, 2026
Merged

Add [MethodImpl(NoInlining)] to methods using GetCallingAssembly#29
Shane32 merged 1 commit into
masterfrom
copilot/mark-getcallingassembly-methods

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 24, 2026

Assembly.GetCallingAssembly() returns the wrong assembly if the JIT inlines the calling method. Methods relying on it must be marked [MethodImpl(MethodImplOptions.NoInlining)] to guarantee correct behavior.

Changes

  • Added [MethodImpl(MethodImplOptions.NoInlining)] with explanatory comment to all three overloads that call Assembly.GetCallingAssembly():
    • GraphQLDIBuilderExtensions.AddDI()
    • GraphQLBuilderExtensions.AddDIGraphBases()
    • GraphQLBuilderExtensions.AddDIClrTypeMappings()
  • Added using System.Runtime.CompilerServices; to both files

@github-actions
Copy link
Copy Markdown

Coverage Report

Totals Coverage
Statements: 95.74% ( 135 / 141 )
Methods: 85.71% ( 42 / 49 )

@Shane32 Shane32 merged commit 5cfac23 into master May 24, 2026
6 checks passed
@Shane32 Shane32 deleted the copilot/mark-getcallingassembly-methods branch May 24, 2026 20:22
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