Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The issue of array copy #19

Open
tangdf opened this issue Apr 19, 2018 · 1 comment
Open

The issue of array copy #19

tangdf opened this issue Apr 19, 2018 · 1 comment

Comments

@tangdf
Copy link
Contributor

tangdf commented Apr 19, 2018

Demo Code:

            var originalArray = new string[] { "123", "hello!" };
            var resultArray = DeepCopier.Copy((object)original);
            Assert.Equal(originalArray, resultArray);
            Assert.NotSame(originalArray, resultArray);

Stace Trace:

System.ArgumentException : Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
at System.Reflection.RuntimeMethodInfo.CreateDelegateInternal(Type delegateType, Object firstArgument, DelegateBindingFlags bindingFlags, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.CreateDelegate(Type delegateType)
at DeepCopy.CopierGenerator1.CreateArrayCopier(Type type) at DeepCopy.CopierGenerator1.CreateCopier(Type type)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at DeepCopy.CopierGenerator`1.Copy(T original, CopyContext context)
at DeepCopy.DeepCopier.Copy[T](T original)
at DeepCopy.UnitTests.CopyTests.CanCopyArrays()

@alirezapla
Copy link

If you want to continue using DeepCopier, ensure that you are calling it correctly

var originalArray = new string[] { "123", "hello!" };
var resultArray = DeepCopier.Copy(originalArray); // Ensure you're passing the correct type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants