Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/DeepCopy/CopierGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public static T Copy(T original, CopyContext context)
if (original == null) return original;

var type = original.GetType();

if (type.FullName?.Equals("System.RuntimeType", StringComparison.InvariantCulture) ?? false) return original;

if (type == GenericType) return MatchingTypeCopier(original, context);

var result = Copiers.GetOrAdd(type, GenerateCopier);
Expand Down
8 changes: 8 additions & 0 deletions test/DeepCopy.UnitTests/CopyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ namespace DeepCopy.UnitTests
[Trait("TestCategory", "BVT")]
public class CopyTests
{
[Fact]
public void CanCopyTypes()
{
var original = typeof(string);
var result = DeepCopier.Copy(original);
Assert.Same(original, result);
}

[Fact]
public void CanCopyStrings()
{
Expand Down