monotorrent: Failed to compare two elements in the array. - Monotorrent v3.0.0-beta.rev0102

System.InvalidOperationException
Message : Failed to compare two elements in the array.
StackTrace :    at System.Collections.Generic.GenericArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
   at System.Array.BinarySearch[T](T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
   at System.Collections.Generic.SortedList`2.Add(TKey key, TValue value)
   at MonoTorrent.BEncoding.BEncodeDecoder.DecodeTorrent(Stream reader)
   at MonoTorrent.Torrent.Load(Stream stream, ReadOnlySpan`1 buffer)
   at MonoTorrent.Torrent.Load(String path)
   at MultiUploader.Helpers.Torrents.IsImageFromTorrent(String torrentFile)
System.BadImageFormatException
Message : Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
StackTrace :    at System.ReadOnlyMemory`1.get_Span()
   at MonoTorrent.BEncoding.BEncodedString.CompareTo(BEncodedString other)
   at System.Collections.Generic.GenericArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value)
   at System.Collections.Generic.GenericArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
System.BadImageFormatException
Message : Cannot load a reference assembly for execution.

My Code is:

foreach (TorrentFile file in Torrent.Load(torrentFile)) {
         if (Regex.IsMatch(file.Path, "^.*\.(iso|cue)$", RegexOptions.IgnoreCase)) {
             return true;
         }
     }
 }
 return false;

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (14 by maintainers)

Most upvoted comments

still_ref_assembly

I can definitely see the ref assembly listed here… but that shouldn’t happen 😦