diff --git a/TUnit.Engine/Extensions/JsonExtensions.cs b/TUnit.Engine/Extensions/JsonExtensions.cs index b01e75aa5b..5c67caad17 100644 --- a/TUnit.Engine/Extensions/JsonExtensions.cs +++ b/TUnit.Engine/Extensions/JsonExtensions.cs @@ -65,7 +65,7 @@ public static TestJson ToJsonModel(this TestContext context) classParamTypeNames = new string[classParameterTypes.Length]; for (var i = 0; i < classParameterTypes.Length; i++) { - classParamTypeNames[i] = classParameterTypes[i].FullName ?? "Unknown"; + classParamTypeNames[i] = classParameterTypes[i]?.FullName ?? classParameterTypes[i]?.Name ?? "Unknown"; } } else @@ -77,7 +77,7 @@ public static TestJson ToJsonModel(this TestContext context) var methodParamTypeNames = new string[methodParameters.Length]; for (var i = 0; i < methodParameters.Length; i++) { - methodParamTypeNames[i] = methodParameters[i].Type.FullName ?? "Unknown"; + methodParamTypeNames[i] = methodParameters[i].Type?.FullName ?? methodParameters[i].Type?.Name ?? "Unknown"; } return new TestJson diff --git a/TUnit.Engine/Services/PropertyInjector.cs b/TUnit.Engine/Services/PropertyInjector.cs index a6492ad786..16f0c1afa5 100644 --- a/TUnit.Engine/Services/PropertyInjector.cs +++ b/TUnit.Engine/Services/PropertyInjector.cs @@ -230,6 +230,7 @@ private Task InjectSourceGeneratedPropertiesAsync( } [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Source-gen properties are AOT-safe")] + [UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "ContainingType is annotated with DynamicallyAccessedMembers in PropertyInjectionMetadata")] private async Task InjectSourceGeneratedPropertyAsync( object instance, PropertyInjectionMetadata metadata, @@ -376,6 +377,7 @@ private Task RecurseIntoNestedPropertiesAsync( return Task.CompletedTask; } + [UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "ContainingType is annotated with DynamicallyAccessedMembers in PropertyInjectionMetadata")] private async Task RecurseIntoNestedPropertiesCoreAsync(object instance, PropertyInjectionPlan plan, ConcurrentDictionary objectBag, MethodMetadata? methodMetadata, TestContextEvents events, ConcurrentDictionary visitedObjects, CancellationToken cancellationToken)