question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with simple serialization/deserialization of a double

See original GitHub issue

I have been using the package for a while in this application. This seem to have been working. I moved from “standard” serialization to extended because I was having issues with serializing my dictionary.

Fair disclosure…Currently I have been working on other aspects of the project and I may not have noticed if things were not working properly with the serialization. Today I started having issues with serialization/deserialization of dictionary<list<byte[]>, MyCustomClass>. Digging deeper I added test code to serialize and deserialize a variable of type double:

double y = 0;
//Read double test
try
{
	using (var stream = storage.TryOpenStream("Test", true))
	{
		var serializer = new ConfigurationContainer()
			.EnableImplicitTyping(typeof(double))
			.Create();

		serializer.Serialize(stream, y);

		Debug.WriteLine("Successfully read test on open");
	}

}
catch (Exception ex)
{
	Debug.WriteLine(ex);
}

I started having IO exceptions so I uninstalled and reinstalled the NuGet package.

Now when I run the above code I get the following error on the ‘serializer.Serialize’ line:

Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Xml.dll
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Xml.dll
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Xml.dll
System.Runtime.InteropServices.COMException (0x80030005): Access Denied. (Exception from HRESULT: 0x80030005 (STG_E_ACCESSDENIED))
   at System.Runtime.InteropServices.ComTypes.IStream.Write(Byte[] pv, Int32 cb, IntPtr pcbWritten)
   at System.Xml.XmlUtf8RawTextWriter.FlushBuffer()
   at System.Xml.XmlUtf8RawTextWriter.Flush()
   at System.Xml.XmlWellFormedWriter.Flush()
   at ExtendedXmlSerializer.ExtensionModel.Xml.InstanceFormatter.Get(Object parameter)
   at ExtendedXmlSerializer.ExtensionMethodsForSerialization.Serialize(IExtendedXmlSerializer this, Stream stream, Object instance)
   at Dispensing.DocumentHandler.HandleStorageReadAvailable(IXDocument doc) in C:\Users\erics\source\repos\TestingEFClassLibrary\TestingEFClassLibrary\DocumentHandler.cs:line 159

I am running as administrator as I am developing a class library and debugging requires that the dll gets registered. AFAIK this has not caused an issue before.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
flycastcommented, Nov 2, 2021

Thanks. @flycast from back in my fly fishing days. You are right, it has to be something locally. I saved everything. restarted and restarted with a very, very basic serialization. I have progressively challenged it with more and more complex serializations.

Sorry for the scare.

.NET 4.8.

Everything looks good now. Sorry for the trouble.

By the way. Great response!!! Thanks for adding the test.

0reactions
Mike-E-angelocommented, Nov 2, 2021

Thanks. @flycast from back in my fly fishing days

Yes! A River Runs Through It is also one of my favorites. Additionally, there used to be an ad agency by that name and it’s how I earned my first “internet coin” (wayyyyyyy before there was anything like crypto) so I am a fan. 😅

Sorry for the scare.

Hah! No worries. If it helps, here’s me doing a faceplant of fail on the ASP.NET Core mothership that was actually due to all my own doing. So, I am very (painfully) familiar with having something not work and reaching out in an attempt to track it down. It’s part of what makes open source so cool. 😃

Very glad to hear you got sorted. If you do have any further questions/issues, please do reach out and I’ll do my best to assist. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Facing deserialization issue due to double quotes in data
I am facing deserialization issue because response contains data like below, ... the issue is serialization,mine is deserialization issues.
Read more >
Problem with Serialize/Deserialize of Double
Hey all, I want to include a "double" value in a hello message that I send. Basically it is the velocity that I...
Read more >
Issue when serializing double · Issue #202 · USCiLab/cereal
Serializing using a binary archive should save the raw binary representation of the double (base64 encoded), and therefore give a bit-wise ...
Read more >
Serialization and Deserialization in Java with Example
Serialization is a mechanism of converting the state of an object into a byte stream. Deserialization is the reverse process where the byte ......
Read more >
What Are Serialization and Deserialization in Programming?
Serialization and deserialization are two important concepts in programming that allow objects to be easily stored, transmitted, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found