Giter Club home page Giter Club logo

Comments (4)

force-net avatar force-net commented on July 19, 2024

Is it only on .net6? Can you provide minimal snippet of code which cause this problem?

from deepcloner.

AnthonyAtApex avatar AnthonyAtApex commented on July 19, 2024

It's possible that it's in .Net 5 too, but it was exacerbated with .Net 6. QA says they've saw the SOAP issue since we implemented DeepCloner it just wasn't reproducible on demand like it was with .Net 6.

we were using it like this:

public static T? Clone(this T source)
{
return source == null ? default : source.DeepClone();
}

public static async Task<T?> CloneAsync(this T source)
{
return await Task.FromResult(source.Clone());
}

public static async Task<T?> CloneDataContractAsync(this T source)
{
return await Task.FromResult(source.CloneDataContract());
}

await sqlConnection.CloneAsync();

from deepcloner.

force-net avatar force-net commented on July 19, 2024

Please, do on clone SqlConnection object. DeepCloner will create not copy of connection, but copy of connection class. So, you'll have two simultaneous instances of one sql connection.
Moreover, SqlConnection uses native resources which impossible to clone (it's out of .NET). So, when you Dispose one connection and use second - the second one uses already released native resources and this causes Access Violation.

DeepCloner is intended to copy DTO objects without complex logic on it. Yes, it can be used to copy any complex structure, but behavior is undefined for this.

from deepcloner.

AnthonyAtApex avatar AnthonyAtApex commented on July 19, 2024

That makes sense. Thanks.

from deepcloner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.