I know this sounds like a replica of IndexOf method returns 0 when it should had return -1 in C# / Java, but it isn't quite.
If you run this test:
var i = "Hello world".IndexOf("\0");
i will be 0 in net5 and net6, whereas in netcore3.1 i will be -1.
I get it that the compiler may think that "\0" equals "" which by the discussion in the referenced question might be right, but the interesting thing here is the difference between netcore3.1 and the later versions.
My solution to this was to change the test to:
var i = "Hello world".IndexOf('\0');
You may find it odd to look for a zero terminator inside a string, but the sample is taken out of a complex context. This simply nails down the reason why a library stopped working when moved from dotnetcore3.1 to net5/net6.