I also noticed when searching for IndexOutOfRangeException that UTF8toUTF16 can throw it, also. This is unusual to have to deal with, so we should change this method to TryUTF8toUTF16 so we can eliminate this exception that is clearly exclusively meant for control flow when the UTF8 format is invalid. It is caught in several places to do a fallback, and we should fix this. Note that we will most likely be converting the byte[] overload to use ReadOnlySpan<byte> and getting rid of the offset and length parameters.
_Originally posted by @NightOwl888 in https://github.com/apache/lucenenet/pull/1018#discussion_r1842253910_