Skip to content

Commit

Permalink
Merge pull request #203 from Emik03/fix-isunmanaged
Browse files Browse the repository at this point in the history
Fix DotNext.Reflection.TypeExtensions.IsUnmanaged
  • Loading branch information
sakno authored Nov 11, 2023
2 parents ad31151 + 0b19ec2 commit 53f13c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/DotNext.Tests/Reflection/TypeExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ public static void IsUnmanaged()
True(typeof(bool).IsUnmanaged());
True(typeof(Guid).IsUnmanaged());
True(typeof(DateTime).IsUnmanaged());
False(typeof(Runtime.InteropServices.Pointer<int>).IsUnmanaged());
True(typeof((int, int)).IsUnmanaged());
True(typeof(Runtime.InteropServices.Pointer<int>).IsUnmanaged());
False(typeof(ManagedStruct).IsUnmanaged());
False(typeof((int, string)).IsUnmanaged());
var method = new Func<int>(SizeOf<long>).Method;
method = method.GetGenericMethodDefinition();
True(method.GetGenericArguments()[0].IsUnmanaged());
Expand Down
2 changes: 1 addition & 1 deletion src/DotNext/Reflection/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static bool IsUnmanaged(this Type type)
{
switch (type)
{
case { IsGenericType: true } or { IsGenericTypeDefinition: true } or { IsGenericParameter: true }:
case { IsGenericTypeDefinition: true }:
foreach (var attribute in type.GetCustomAttributesData())
{
if (attribute.AttributeType.FullName == IsUnmanagedAttributeName)
Expand Down

0 comments on commit 53f13c4

Please sign in to comment.