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.

How to transition from binary to json serialization

See original GitHub issue

The Quartz.NET Version Migration Guide states that binary serialization is not supported when targeting .NET Core.

We are migrating our application from .NET Framework to .NET Core and so far we have used binary as our serialization format.

Is there an official guide on how to transition from binary to json? Do we have to manually convert the tables columns from varbinary to varchar and if so which ones and how?

Here is our current configuration:

new NameValueCollection
{
    { "quartz.jobStore.type", "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" },
    { "quartz.serializer.type", "binary" },
    { "quartz.jobStore.dataSource", "myDS" },
    { "quartz.dataSource.myDS.connectionString", "xxxx" },
    { "quartz.dataSource.myDS.provider", "SqlServer" },
    { "quartz.scheduler.instanceName", "xxxx scheduler" },
};

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lahmacommented, Apr 14, 2021

Thank you @peabnuts123 for sharing your solution, I’ve updated the JSON serialization integration documentation to include these tips and the sample serializer. I’ve also linked to this doc from migration guide.

1reaction
lahmacommented, Apr 8, 2021

@lahma @dsedmak It looks like this is 100% incompatible with .NET Standard or .NET Core, as the NameValueCollection class is no-longer marked as “Serializable”. This produces behaviour seen in a few other issues on here (#672, #661) wherein trying to use “binary” serialisation while running in a .NET Core (or, presumably .NET Standard) throws a runtime exception.

OK I can understand your pain, that’s bad.

What about creating a composite IObjectSerializer that reads using BinaryObjectSerializer and writes back using JsonObjectSerializer (and configuring that for for the job store)? This would require you to create an app that uses Quartz API to load all relevant entities (triggers, jobs and calendars I guess) and then persist them back to database again effectively transforming the format?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serializing binary types to a JSON string
Binary value types can't be serialized to JSON in our current ... Here's one way to look at it: you can convert arbitrary...
Read more >
How to convert binary data to json - python
3. Split by newlines, JSON-decode each line separately. – deceze Oct 14, 2022 at 19:28 · my_json = content.decode('utf8').split('\n') json_data ...
Read more >
Binary to JSON File Saving | Unity | Settings - Part 7 - YouTube
As far as I know, binary file saving is no longer safe to use! I'm not entirely sure when this was declared but...
Read more >
[SOLVED] Future-proofing the Save() function - JSON or ...
I currently make use of binary serialization to save and load the game. ... load the binary into the correct class, and then...
Read more >
Replacing BinaryFormatter with Json.NET - Show
When the RPG Course Saving System was introduced in the first course, Core Combat, we used the BinaryFormatter to serialize and deserialize the...
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