ReflectionFallbackHandlers
NexusLabs.Needlr.Injection.Reflection¶
NexusLabs.Needlr.Injection.Reflection¶
ReflectionFallbackHandlers Class¶
Provides built-in handlers for reflection fallback scenarios. Use these with WithReflectionFallbackHandler(this ConfiguredSyringe, Action<ReflectionFallbackContext>) to control what happens when source-generated components are not available.
Inheritance System.Object 🡒 ReflectionFallbackHandlers
Methods¶
ReflectionFallbackHandlers.CreateAssemblyProviderContext() Method¶
Creates context for AssemblyProvider fallback.
public static NexusLabs.Needlr.Injection.Reflection.ReflectionFallbackContext CreateAssemblyProviderContext();
Returns¶
ReflectionFallbackHandlers.CreatePluginFactoryContext() Method¶
Creates context for PluginFactory fallback.
public static NexusLabs.Needlr.Injection.Reflection.ReflectionFallbackContext CreatePluginFactoryContext();
Returns¶
ReflectionFallbackHandlers.CreateTypeFiltererContext() Method¶
Creates context for TypeFilterer fallback.
public static NexusLabs.Needlr.Injection.Reflection.ReflectionFallbackContext CreateTypeFiltererContext();
Returns¶
ReflectionFallbackHandlers.CreateTypeRegistrarContext() Method¶
Creates context for TypeRegistrar fallback.
public static NexusLabs.Needlr.Injection.Reflection.ReflectionFallbackContext CreateTypeRegistrarContext();
Returns¶
ReflectionFallbackHandlers.LogWarning(ReflectionFallbackContext) Method¶
A handler that writes a warning to System.Console.Error when reflection fallback occurs. Useful for development/debugging to identify missing source generation.
public static void LogWarning(NexusLabs.Needlr.Injection.Reflection.ReflectionFallbackContext context);
Parameters¶
context ReflectionFallbackContext
Example¶
ReflectionFallbackHandlers.Silent(ReflectionFallbackContext) Method¶
A handler that does nothing when reflection fallback occurs. This is the default behavior - silent fallback to reflection.
Parameters¶
context ReflectionFallbackContext
ReflectionFallbackHandlers.ThrowException(ReflectionFallbackContext) Method¶
A handler that throws an System.InvalidOperationException when reflection fallback occurs. Use this to enforce source-generation in AOT/trimmed applications.
public static void ThrowException(NexusLabs.Needlr.Injection.Reflection.ReflectionFallbackContext context);
Parameters¶
context ReflectionFallbackContext