Need help decoding Bson

460 views
Skip to first unread message

sLaVeN

unread,
May 24, 2012, 6:38:33 PM5/24/12
to mongodb-csharp
Hi,

I need help decoding Bson. I am making a WebRequest and getting
encoded Bson blob which I need to decode in C#. IN java you would do
something like this

static main(args)
{
if(args.length != 1)
{
println("Usage
<binFile>")
}
BSONDecoder decoder = new
BSONDecoder()
BSONObject bson = decoder.readObject
(new FileInputStream(args[0]))
OutputBson(System.out, bson, 0)
}

but I need to do similar in C#. Could somebody help me do this in C#?
What would be BSONDecoder equivalant in C#? I have the Mongo
Driver,BSON DLL so i just need to find out the right set of calls to
decode it.

Thanks

Robert Stam

unread,
May 24, 2012, 6:43:30 PM5/24/12
to mongodb...@googlegroups.com
Write whatever code you need to get the BSON data as a byte array, and then you can decode it using:

    byte[] bytes;
    BsonDocument document = BsonSerializer.Deserialize<BsonDocument>(bytes);

Robert Stam

unread,
May 24, 2012, 6:49:11 PM5/24/12
to mongodb...@googlegroups.com
You can also deserialize BSON data directly from a binary stream, like this:

    Stream stream;
    var document = BsonSerializer.Deserialize<BsonDocument>(stream);

sLaVeN

unread,
May 24, 2012, 7:57:09 PM5/24/12
to mongodb-csharp
Thanks Robert for the quick reply. I tried that but I am getting an
exception.

string bson = File.ReadAllText(@"C:\Users\myuser\Desktop\bson.txt");
byte[] bytesarr = Encoding.UTF8.GetBytes(bson); // Tried different
Encoding here but that didn't seem to matter.
BsonDocument document =
MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>(bytesarr);


Steps:
1) Convert bsonresponse to bytes array
2) Call the Deserializer you have provided
3) Execute and i get following exception


Unhandled Exception: System.IO.EndOfStreamException: Attempted to read
past the
end of the stream.
at MongoDB.Bson.IO.BsonBuffer.LoadFrom(Stream stream, Int32 count)
at MongoDB.Bson.IO.BsonBuffer.LoadFrom(Stream stream)
at MongoDB.Bson.IO.BsonReader.Create(Stream stream,
BsonBinaryReaderSettings
settings)
at MongoDB.Bson.Serialization.BsonSerializer.Deserialize(Stream
stream, Type
nominalType)
at MongoDB.Bson.Serialization.BsonSerializer.Deserialize(Byte[]
bytes, Type n
ominalType)
at
MongoDB.Bson.Serialization.BsonSerializer.Deserialize[TNominalType]
(Byte[]
bytes)
at Test.Program.Main(String[] args) in C:\project
\XPathFormatingTools\Test\Te
st\Program.cs:line 54


Thanks Alot!

On May 24, 3:49 pm, Robert Stam <rob...@10gen.com> wrote:
> You can also deserialize BSON data directly from a binary stream, like this:
>
>     Stream stream;
>     var document = BsonSerializer.Deserialize<BsonDocument>(stream);
>
>
>
>
>
>
>
> On Thu, May 24, 2012 at 6:43 PM, Robert Stam <rob...@10gen.com> wrote:
> > Write whatever code you need to get the BSON data as a byte array, and
> > then you can decode it using:
>
> >     byte[] bytes;
> >     BsonDocument document =
> > BsonSerializer.Deserialize<BsonDocument>(bytes);
>

Robert Stam

unread,
May 24, 2012, 10:29:41 PM5/24/12
to mongodb...@googlegroups.com
BSON is a binary encoding. If your file is not a binary file you won't be able to decode it as BSON.

If your file is a text file containing JSON you will want to parse it a different way:

string json; // load this from your file
BsonDocument document = BsonSerializer.Deserialize<BsonDocument>(json);

sLaVeN

unread,
May 25, 2012, 1:15:45 PM5/25/12
to mongodb-csharp
Hi Robert,

yes, there could have been an issue there because I was trying to
convert the stream to string as well as bytes array which was giving
me those issues. However, I tried now to pass in the stream directly
to the Deserializer and it looks like its trying to do something but
complains about Duplicate element. There is no duplicate element. We
have WebApp where we can make these calls and Json that Im getting
back is fine, no duplicates but when i try to do it from my C# code, i
get the following error. Could there be a bug in the Driver? Thanks


Unhandled Exception: System.InvalidOperationException: Duplicate
element name 'm
_fleg'.
at MongoDB.Bson.BsonDocument.Add(BsonElement element)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonArray.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonArray.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.BsonDocument.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonArray.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonValue.ReadFrom(BsonReader bsonReader)
at MongoDB.Bson.BsonElement.ReadFrom(BsonReader bsonReader,
BsonElement& elem
ent)
at MongoDB.Bson.BsonDocument.Deserialize(BsonReader bsonReader,
Type nominalT
ype, IBsonSerializationOptions options)
at MongoDB.Bson.Serialization.BsonSerializer.Deserialize(BsonReader
bsonReade
r, Type nominalType, IBsonSerializationOptions options)
at MongoDB.Bson.Serialization.BsonSerializer.Deserialize(Stream
stream, Type
nominalType)
at
MongoDB.Bson.Serialization.BsonSerializer.Deserialize[TNominalType]
(Stream
stream)
at Test.Program.HttpRequest() in C:\project\XPathFormatingTools\Test
\Test\Pro
gram.cs:line 86
at Test.Program.Main(String[] args) in C:\project
\XPathFormatingTools\Test\Te
st\Program.cs:line 61
Press any key to continue . . .

craiggwilson

unread,
May 25, 2012, 2:44:55 PM5/25/12
to mongodb...@googlegroups.com
Is the stream you are passing in encoded in BSON or is it a JSON string encoded as binary?  As in, does the stream match the bson spec here:  http://bsonspec.org/#/specification?

sLaVeN

unread,
May 25, 2012, 4:16:28 PM5/25/12
to mongodb-csharp
Hmm, I am not sure how the server is returning it to me but I would
assume it would be BSON because we have some other apps that do
similar things and display it as JSON. However, I could go with an
assumption that it could be JSON encoded as binary. If thats the case,
how would I got about decoding the Json Binary to regular JSON?

Thanks
> ...
>
> read more »

craiggwilson

unread,
May 25, 2012, 4:38:27 PM5/25/12
to mongodb...@googlegroups.com
Well, here's a test.  Take the stream you are getting from the server, use Encoding.UTF8.GetString(byetArray) and save that to a file.  if it is legible, then it is a json string.  If not, we'll go from there.
Message has been deleted

craiggwilson

unread,
May 25, 2012, 5:12:40 PM5/25/12
to mongodb...@googlegroups.com
Cool, that looks like it is probably bson.  Here's what to do next.  Take the byte array and save it to a file on disk.  Then we can use the bsondump.exe in the bin directory of your mongo installation and inspect the file.

bsondump.exe {filename}

If you can, post the results here.  If not, tell me if everything looks valid.

On Friday, May 25, 2012 4:48:57 PM UTC-4, sLaVeN wrote:
It looks something like that once saved to File

  ?RgPmtSg ?     ?m_mcFO ?   ?m_mss _   ?Wu
e -   ?m_lVdfgs         ?BYTEm_nDecPlaces      ?m_cy ?   ?
bson_string ?      ?m_
mooNet _   ?WSnValue -   ?m_lValue         ?BYTEm_nDecPlaces      ?
m_cy
?   ?bson_string ?       ?m_mcAddOnBase ?   ?m_ms _   ?WSValue -
> ...
>
> read more »

sLaVeN

unread,
May 25, 2012, 7:08:30 PM5/25/12
to mongodb-csharp
Hi Craig,

I just ran the bsondump and it seems everything is looking good now.
Unfortunately I cant post the results since its company confidential
data but if there is a way to diagrammatically do this now, that would
be job done :).

Thanks
> ...
>
> read more »

craiggwilson

unread,
May 25, 2012, 7:26:55 PM5/25/12
to mongodb...@googlegroups.com
So if the bsondump prints good data, then I'm not sure what to say about your problem.  Robert gave the way the .net driver uses to deserialize bson.  BsonSerializer.Deserialize<BsonDocument>(bson) //or some other overload

Can you post the code you are using from receipt of the bson to where you are decoding it (or as much as possible)?

sLaVeN

unread,
May 26, 2012, 11:00:52 AM5/26/12
to mongodb-csharp
This is sort of what I am using right now to just test it out









public static HttpRequest(string url)
{
   WebRequest request = null;




            string url = url;
            request = WebRequest.Create(url);


            request.Method = "GET";
            request.Proxy = null;
            request.Timeout = 60000;

            Stream stream = request.GetResponse().GetResponseStream();
            var document =
MongoDB.Bson.Serialization.BsonSerializer.Deserialize<BsonDocument>(stream); //
Tried Byte array, string and few other types.
> ...
>
> read more »

craiggwilson

unread,
May 28, 2012, 6:25:26 PM5/28/12
to mongodb...@googlegroups.com
That looks right to me.  We are going to be kinda stuck here unless you can provide us with a sample of the bson you are trying to decode, or at least an example that breaks.  If you are okay providing 10gen with a copy of the data so we can debug through it, then you can create a jira issue for the project "Community Private".  It will only be seen by 10gen employees.  You can assign it to me, Craig Wilson and I'll look at it asap.   https://jira.mongodb.org/secure/CreateIssue!default.jspa

Hope this will help.

Robert Stam

unread,
May 28, 2012, 6:56:46 PM5/28/12
to mongodb...@googlegroups.com
In one of your earlier messages you mentioned that you got this exception:

Unhandled Exception: System.InvalidOperationException: Duplicate element name 'm_fleg'

If you got that exception it would seem that you were in the process of properly decoding a binary BSON stream but that the C# driver found a duplicate element name (even though you don't think there are any duplicates).

The BSON spec is silent on whether duplicate names are allowed. The various drivers and the server differ on whether they allow duplicate names to be created in the first place and how they respond when they encounter a duplicate name. The C# driver is on the strict side and throws exceptions when a duplicate element is encountered. The server often doesn't even notice when duplicate element names are stored. Some drivers handle duplicate names by overwriting the value with the last value encountered.

I strongly suspect that you really do have a duplicate element name, even if you don't think you do.

sLaVeN

unread,
May 29, 2012, 9:01:47 PM5/29/12
to mongodb-csharp
I just double check and yes indeed, there are some duplicate elements.
Now I downloaded the source code and I do see that you guys have a
flag to allow duplicate elements. How can I use this flag to allow
duplicate elements? I think that would solve the problem.

Thanks

On May 28, 3:56 pm, Robert Stam <rob...@10gen.com> wrote:
> In one of your earlier messages you mentioned that you got this exception:
>
> Unhandled Exception: System.InvalidOperationException: Duplicate element
> name 'm_fleg'
>
> If you got that exception it would seem that you were in the process of
> properly decoding a binary BSON stream but that the C# driver found a
> duplicate element name (even though you don't think there are any
> duplicates).
>
> The BSON spec is silent on whether duplicate names are allowed. The various
> drivers and the server differ on whether they allow duplicate names to be
> created in the first place and how they respond when they encounter a
> duplicate name. The C# driver is on the strict side and throws exceptions
> when a duplicate element is encountered. The server often doesn't even
> notice when duplicate element names are stored. Some drivers handle
> duplicate names by overwriting the value with the last value encountered.
>
> I strongly suspect that you really do have a duplicate element name, even
> if you don't think you do.
>
> On Mon, May 28, 2012 at 6:25 PM, craiggwilson <craiggwil...@gmail.com>wrote:
>
>
>
>
>
>
>
> > That looks right to me.  We are going to be kinda stuck here unless you
> > can provide us with a sample of the bson you are trying to decode, or at
> > least an example that breaks.  If you are okay providing 10gen with a copy
> > of the data so we can debug through it, then you can create a jira issue
> > for the project "Community Private".  It will only be seen by 10gen
> > employees.  You can assign it to me, Craig Wilson and I'll look at it asap.
> >  https://jira.mongodb.org/secure/CreateIssue!default.jspa
>
> > Hope this will help.
>
> > On Saturday, May 26, 2012 11:00:52 AM UTC-4, sLaVeN wrote:
>
> >> This is sort of what I am using right now to just test it out
>
> >>         public static HttpRequest(string url)
> >>         {
> >>             WebRequest request = null;
>
> >>             string url = url;
> >>             request = WebRequest.Create(url);
>
> >>             request.Method = "GET";
> >>             request.Proxy = null;
> >>             request.Timeout = 60000;
>
> >>             Stream stream = request.GetResponse().**GetResponseStream();
> >>             var document =
> >> MongoDB.Bson.Serialization.**BsonSerializer.Deserialize<**BsonDocument>(str eam); //
>
> >> Tried Byte array, string and few other types.
> >>     }
>
> >> On May 25, 4:26 pm, craiggwilson <craiggwil...@gmail.com> wrote:
> >> > So if the bsondump prints good data, then I'm not sure what to say
> >> about
> >> > your problem.  Robert gave the way the .net driver uses to deserialize
> >> > bson.  BsonSerializer.Deserialize<**BsonDocument>(bson) //or some
> >> > > > > > Encoding.UTF8.GetString(**byetArray) and save that to a file.
> >> > > > > > >http://bsonspec.org/#/**specification<http://bsonspec.org/#/specification>?
> >> > > > > > > > > Unhandled Exception: System.**InvalidOperationException:
> >> > > Duplicate
> >> > > > > > > > > element name 'm
> >> > > > > > > > > _fleg'.
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.Add(**BsonElement
> >> element)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**Deserialize(BsonReader
> >> > > bsonReader,
> >> > > > > > > > > Type nominalT
> >> > > > > > > > > ype, IBsonSerializationOptions options)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**ReadFrom(BsonReader
> >> > > bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonValue.**ReadFrom(BsonReader
> >> bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonElement.**ReadFrom(BsonReader
> >> bsonReader,
> >> > > > > > > > > BsonElement& elem
> >> > > > > > > > > ent)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**Deserialize(BsonReader
> >> > > bsonReader,
> >> > > > > > > > > Type nominalT
> >> > > > > > > > > ype, IBsonSerializationOptions options)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**ReadFrom(BsonReader
> >> > > bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonValue.**ReadFrom(BsonReader
> >> bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonElement.**ReadFrom(BsonReader
> >> bsonReader,
> >> > > > > > > > > BsonElement& elem
> >> > > > > > > > > ent)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**Deserialize(BsonReader
> >> > > bsonReader,
> >> > > > > > > > > Type nominalT
> >> > > > > > > > > ype, IBsonSerializationOptions options)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**ReadFrom(BsonReader
> >> > > bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonValue.**ReadFrom(BsonReader
> >> bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonElement.**ReadFrom(BsonReader
> >> bsonReader,
> >> > > > > > > > > BsonElement& elem
> >> > > > > > > > > ent)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**Deserialize(BsonReader
> >> > > bsonReader,
> >> > > > > > > > > Type nominalT
> >> > > > > > > > > ype, IBsonSerializationOptions options)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**ReadFrom(BsonReader
> >> > > bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonValue.**ReadFrom(BsonReader
> >> bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonArray.**ReadFrom(BsonReader
> >> bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonValue.**ReadFrom(BsonReader
> >> bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonElement.**ReadFrom(BsonReader
> >> bsonReader,
> >> > > > > > > > > BsonElement& elem
> >> > > > > > > > > ent)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**Deserialize(BsonReader
> >> > > bsonReader,
> >> > > > > > > > > Type nominalT
> >> > > > > > > > > ype, IBsonSerializationOptions options)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**ReadFrom(BsonReader
> >> > > bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonValue.**ReadFrom(BsonReader
> >> bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonElement.**ReadFrom(BsonReader
> >> bsonReader,
> >> > > > > > > > > BsonElement& elem
> >> > > > > > > > > ent)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**Deserialize(BsonReader
> >> > > bsonReader,
> >> > > > > > > > > Type nominalT
> >> > > > > > > > > ype, IBsonSerializationOptions options)
> >> > > > > > > > >    at MongoDB.Bson.BsonDocument.**ReadFrom(BsonReader
> >> > > bsonReader)
> >> > > > > > > > >    at MongoDB.Bson.BsonValue.**ReadFrom(BsonReader
> >> bsonReader)
> >> > > > > > > > >    at
>
> ...
>
> read more »

Robert Stam

unread,
May 29, 2012, 10:59:19 PM5/29/12
to mongodb...@googlegroups.com
I would strongly recommend that you never allow duplicate element names to occur. They behave differently in different situations and lead to unpredictable outcomes.

However, in the C# driver you can tell it to always allow duplicate names during deserialization if you want to. I would recommend you use this technique only while cleaning up the data.

I created a test document with duplicate elements like this:

    var server = MongoServer.Create("mongodb://localhost/?safe=true");
    var database = server.GetDatabase("test");
    var collection = database.GetCollection("test");

    var document = new BsonDocument(true)
    {
        { "x", 1 },
        { "x", 2 },
        { "embedded", new BsonDocument(true)
            {
                { "y", 1 },
                { "y", 2 }
            }
        }
    };

    collection.Drop();
    collection.Insert(document);

You can read documents with duplicate elements like this:

    DocumentSerializationOptions.Defaults = new DocumentSerializationOptions { AllowDuplicateNames = true };
    document = collection.FindOne();
    Console.WriteLine(document.ToJson());

But keep in mind that setting DocumentSerializationOptions.Defaults is a global setting and should only be done once when the program is starting up. Manipulating DocumentSerializationOptions.Defaults back and forth between different values is not thread safe (which may not be an issue if your program is single threaded).
Reply all
Reply to author
Forward
0 new messages