Can use System.Text.Json in C++/CLI project?

西波 温 1 Reputation point
2022-03-06T09:33:26.443+00:00

I'm a new programmer in C++/CLI , I want to using json library .

MS said that System.Text.Json is faster than Newtonsoft .

I install System.Text.Json by NuGet , than try this code :

auto jdoc= System::Text::Json::JsonDocument::Parse(jsonstr, System::Text::Json::JsonDocumentOptions());

But compiler report Error C2079 'System::Buffers::ReadOnlySequence::Enumerator::_sequence' uses undefined class 'System::Buffers::ReadOnlySequence'

It seem that ReadOnlySequence class had not been defined .

I think maybe System.Memory library need update, than install System.Memory 4.5.4 , but the compiler error still exist.

Even I write a ReadOnlySequence instance :

System::Buffers::ReadOnlySequence<unsigned char> testseq;

Also get the compiler error C2079 'System::Buffers::ReadOnlySequence::Enumerator::_sequence' uses undefined class 'System::Buffers::ReadOnlySequence'

Is there any solution ?

.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
325 questions
0 comments No comments
{count} votes