JamesNK / Newtonsoft.Json.Bson

Json.NET BSON adds support for reading and writing BSON to Json.NET
MIT License
55 stars 23 forks source link

Implement async writing. #3

Closed JonHanna closed 7 years ago

JonHanna commented 7 years ago

Only overrides those methods that can result in the stream being written to, as only they can benefit from async I/O.

JamesNK commented 7 years ago

Hi! I want to release this soon. What is the state of async reading? If you have something that is work in progress could you create a PR with it and I'll finish it off.

JonHanna commented 7 years ago

Hi. Sorry, meant to get back to you sooner, but have been busy with several things. I made a start at reading, but found I was having to at the very least hit SetToken in the base, and perhaps more, and didn't make any further progress. I think I might produce a version soon that uses InternalsVisible and we can use that to consider how deep the dependencies are, and see if a non InternalsVisible approach can be figured out from that.

JamesNK commented 7 years ago

I would prefer to make methods/properties on JsonReader/JsonWriter protected rather than use InternalsVisibleTo. Chances are other people will need them.

Is it internal void SetToken(JsonToken newToken, object value, bool updateIndex) that is required?

JonHanna commented 7 years ago

I agree, my idea is to do a version using InternalsVisibleTo not as a proposed change, but to examine just what needs to be exposed.

JamesNK commented 7 years ago

Ah ok. I see InternalsVisibleTo and my gut reaction is skip reading everything else and say no.

How soon is soon? I'd like to release Json.NET 10 and one of the last things holding it up is getting async in BSON fully working. If you put up a WIP PR then I'm happy to finish it off.