Skip to content

Commit

Permalink
Fix ReflectionCachesUpdateHandler_CachesCleared test in aggressive tr…
Browse files Browse the repository at this point in the history
…im mode (dotnet#72682)

The test uses a reflection pattern that isn't recognized by the trimmer. Changing it to use one that is recognized by the trimmer so it doesn't remove the type being tested.

Fix dotnet#57456
  • Loading branch information
eerhardt authored Jul 25, 2022
1 parent 02ffbcd commit 7ec4304
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace System.ComponentModel.Tests
public class ReflectionCachesUpdateHandlerTests
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/57456", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
public void ReflectionCachesUpdateHandler_CachesCleared()
{
AttributeCollection ac1 = TypeDescriptor.GetAttributes(typeof(ReflectionCachesUpdateHandlerTests));
Expand All @@ -20,7 +19,7 @@ public void ReflectionCachesUpdateHandler_CachesCleared()
Assert.Equal(2, ac1.Count);
Assert.Same(ac1[0], ac2[0]);

MethodInfo clearCache = typeof(TypeDescriptionProvider).Assembly.GetType("System.ComponentModel.ReflectionCachesUpdateHandler", throwOnError: true).GetMethod("ClearCache");
MethodInfo clearCache = Type.GetType("System.ComponentModel.ReflectionCachesUpdateHandler, System.ComponentModel.TypeConverter", throwOnError: true).GetMethod("ClearCache");
Assert.NotNull(clearCache);
clearCache.Invoke(null, new object[] { null });

Expand Down

0 comments on commit 7ec4304

Please sign in to comment.