problem about binaryformatter-Collection of common programming errors
Dmitriy Sosunov
c# deserialization wif claims-based-identity binaryformatter
I need help to figure out why BinaryFormatter cannot deserialize identity:var identities = new[]{new ClaimsIdentity(“Bug”){Actor = new ClaimsIdentity(“Bootstrap Context as a string”){BootstrapContext = “this causes issue”},BootstrapContext = new BootstrapContext(“this raw token”)}};var sessionToken = new SessionSecurityToken(new ClaimsPrincipal(identities)); byte[] buffer; using (var ms = new MemoryStream()) {var formatter = new BinaryFormatter();formatter.Serialize(ms, sessionToken);buffer = ms
Chris Ballance
.net serialization binaryformatter assemblyversions
I have a project which uses BinaryFormatter to serialize a collection of structs with string and bool? datatypes.The serialization/deserialization works fine, however if I were to change the assembly which does the work it fails to deserialize because of the header in the binary file indicating that it requires Assembly x instead of Assembly y to handle the data.Is it possible to setup the serialization/deserialization to be assembly agnostic?
Maxime Lorant
c# serialization binaryformatter
I am currently doing a game in C# (for studies purpose). I’m trying to implement a Load/Save feature, which consist of saving every data of the game in a file, and the user can be able to reload the game saved after.In the game I have a nation class attached to each players, and every nation inherit from Nation. For the moment, I have only apply the ISerializable interface on the base class, Nation, because subclasses only have method override and no new attributes to serialize.[Serializable()]
Misha
c# com attributes binaryformatter
I’m getting some external structures from COM library.I want to use BinaryFormatter and just get byte array as package. But I need special attribute on structure to satisfy BinaryFormatter.It’s not my structure so how can I handle this situation?
XBigTK13X
c# .net serialization deserialization binaryformatter
While trying to deserialize a file created by a BinaryFormatter, the following exception is thrown:ArgumentException: An item with the same key has already been added.The stack trace starts at the Deserialize method in BinaryFormatter, and I cannot identify what class in my code is causing the collision.I am serializing 100+ classes marked with the [Serializable] attributeI saw another question suggesting that the cause might be related to fields having duplicate names. However, I cannot find th
Heather
c# serialization memory-mapped-files binaryformatter
I’m trying to serialize my MMF to file and here is the code:class MMF {private const string filename = @”c:\NFS”;private long offset = 0;private long length = 194;private byte[] buffer;public MMF() {using (var mmf =MemoryMappedFile.CreateFromFile(filename, FileMode.OpenOrCreate, null, offset + length, MemoryMappedFileAccess.ReadWriteExecute)) {using (var accessor = mmf.CreateViewAccessor(offset, length, MemoryMappedFileAccess.ReadWriteExecute)) {buffer = new byte[194];/*FS fs = new FS();fs.Files
Stefan Steinegger
c# serialization binaryformatter
I have a DateRange object that represents the notion of Infinity via Static reference as shown below. As you see, the end points that define Infinity are also static references in a different class, DatePoint.Past and DatePoint.Future.Now I need to serialize this (as part of a deep Clone method that uses serialization) and know when it’s deserialized that an instance with DateTime.Min and DateTime.Max as endpoints then the instance should be DateRange.Infinity. So I think I need to make it ISeri
Web site is in building