From faf14b5ca9383d7ca6eb7eec57af64ee5a4a1762 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 24 May 2026 20:14:37 +0000
Subject: [PATCH] Add [MethodImpl(MethodImplOptions.NoInlining)] to methods
calling GetCallingAssembly
---
src/GraphQL.DI/GraphQLBuilderExtensions.cs | 3 +++
src/GraphQL.DI/GraphQLDIBuilderExtensions.cs | 2 ++
2 files changed, 5 insertions(+)
diff --git a/src/GraphQL.DI/GraphQLBuilderExtensions.cs b/src/GraphQL.DI/GraphQLBuilderExtensions.cs
index 29f44f8..8dc9259 100644
--- a/src/GraphQL.DI/GraphQLBuilderExtensions.cs
+++ b/src/GraphQL.DI/GraphQLBuilderExtensions.cs
@@ -1,4 +1,5 @@
using System.Reflection;
+using System.Runtime.CompilerServices;
namespace GraphQL.DI;
@@ -22,6 +23,7 @@ public static IGraphQLBuilder AddDIGraphTypes(this IGraphQLBuilder builder)
/// Scans the calling assembly for classes that implement
/// and registers them as transients within the DI container.
///
+ [MethodImpl(MethodImplOptions.NoInlining)] // inlining would change result of GetCallingAssembly
public static IGraphQLBuilder AddDIGraphBases(this IGraphQLBuilder builder)
=> AddDIGraphBases(builder, Assembly.GetCallingAssembly());
@@ -46,6 +48,7 @@ public static IGraphQLBuilder AddDIGraphBases(this IGraphQLBuilder builder, Asse
/// the , or where another graph type would be automatically mapped
/// to the specified type, or where a graph type has already been registered to the specified clr type.
///
+ [MethodImpl(MethodImplOptions.NoInlining)] // inlining would change result of GetCallingAssembly
public static IGraphQLBuilder AddDIClrTypeMappings(this IGraphQLBuilder builder)
=> AddDIClrTypeMappings(builder, Assembly.GetCallingAssembly());
diff --git a/src/GraphQL.DI/GraphQLDIBuilderExtensions.cs b/src/GraphQL.DI/GraphQLDIBuilderExtensions.cs
index 9cd5110..f82b4b9 100644
--- a/src/GraphQL.DI/GraphQLDIBuilderExtensions.cs
+++ b/src/GraphQL.DI/GraphQLDIBuilderExtensions.cs
@@ -1,4 +1,5 @@
using System.Reflection;
+using System.Runtime.CompilerServices;
using GraphQL.DI;
namespace GraphQL;
@@ -29,6 +30,7 @@ public static class GraphQLDIBuilderExtensions
///
///
///
+ [MethodImpl(MethodImplOptions.NoInlining)] // inlining would change result of GetCallingAssembly
public static IGraphQLBuilder AddDI(this IGraphQLBuilder builder)
=> AddDI(builder, Assembly.GetCallingAssembly());