GithubHelp home page GithubHelp logo

koszeggy / kgysoft.corelibraries Goto Github PK

View Code? Open in Web Editor NEW
54.0 4.0 12.0 144.06 MB

KGy SOFT Core Libraries features high-performance and handy general libraries.

Home Page: https://kgysoft.net/corelibraries

License: Other

C# 99.94% Batchfile 0.01% Smalltalk 0.05%
c-sharp libraries kgysoft performance serialization binary-serialization xml-serialization reflection resource-management collections

kgysoft.corelibraries's Issues

'Unexpected type "XXX" in assembly...'

So, I'm trying the default minimal code from your example to serialize MyClass back and forward. The serialization passes, however on deserialization I've got exception cited in the title.
I just want to make sure that I understand this correctly - Do I actually need to explicitly write all the types used in MyClass structure, or write custom code which does it? That sounds insane. Why do you need that if I already gave the MyClass to Deserialize() method? Shouldn't all types used within MyClass be expected implicitly?
I understand that there are cases like having interface properties ISomething xxx where you would want me to specify that a ConcreteSomething could be used but I don't have that in my case. I have ~18 custom types used in MyClass already and I consider it a very trivial structure... Do you really want me to type typeof(XXX),... for all those types as method's parameters?

Binary Serialization

Hello, how do I deserialize a data structure in c++ that I serialized using the BinarySerializer.Serialize. Thanks

BinarySerializationFormatter AccessViolationException in x86 projects

The constructor of BinarySerializationFormatter crashes in x86 projects with this exception:
AccessViolationException
Fatal error. 0xC0000005
at DynamicEnumComparerInt32`1[[KGySoft.Serialization.Binary.BinarySerializationOptions, KGySoft.CoreLibraries, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b45eba277439ddfe]].ToUInt64(KGySoft.Serialization.Binary.BinarySerializationOptions)

Add this property to the csproj:
<PlatformTarget>x86</PlatformTarget>

Full Example:
KGySoftX86.zip

Deserialize byte array which was serialized by the native BinaryFormatter of .NET framework 4.5.2

I have the following Situation:

I had an old .NET Framework 4.5.2 application that in the past stored the following objects serialized by the native BinaryFormatter in a SQL database:

[Serializable]
[DataContract]
public class MyClass
{
    [DataMember]
    private ConcurrentDictionary<DaylightFactorType, double[]> _values = new();
}

Now I have upgraded the application to ASP.NET 8 and when I now try to load and deserialize the data using the native BinaryFormatter, I get the following exception:

Type 'System.Collections.Concurrent.ConcurrentDictionary`2[[MyClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Double[], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' in Assembly 'System.Collections.Concurrent, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.

So I thought I'd use the KGySoft.CoreLibraries to deserialize the data, because it should be possible to deserialize types that are no longer marked as [Serializable].

But the problem now is that I always get null back from the method BinarySerializer.DeserializeFromStream<T>(stream).

How can I solve this? Because the DB is actually read-only for me, and it would be a big effort to fill the database again.

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.