Thank you for submitting your inquiry.
You can track the status of your inquiry here.
You may want to save your case's ticket: 1030883_ae6hmfe09hl2ljob


    (Closed) [different behavior] List<T>.LastIndexOf(T) when List<T> is Empty
     
     
     
    4
    [different behavior] List<T>.LastIndexOf(T) when List<T> is Empty

    1. What happened

    List<T>.LastIndexOf(T) when List<T> is Empty" , different behavior between UnityMono and C#

    in C#
    when List<T> is empty, call List<T>.LastIndexOf(T) , it will be return -1;

    but in Unity Mono
    throw [ArgumentOutOfRangeException: Argument is out of range.]

    2. How we can reproduce it using the example you attached

    Create a new C# script and run
    ---------
    var names = new List<string>();
    Debug.Log(names.LastIndexOf("aaa"));
    ---------

    License type: Free
     
       
      To follow up on this case, send email to bugs@unity3d.com mentioning 'Case 1030883' in the subject.
      Your Cases:
      Case Title Status Date Opened
      1120659 Some Android Devices has graphic issue when texture is rectangle( eg.128x64 ) and set "Generate Mip Maps" ON Closed 1/25/2019 6:10 AM
      1107092 Tangent.w value in shader was different between Unity2017 and Unity2018 Closed 12/6/2018 4:00 AM
      1046996 Wrong Position when i use LayoutGroup & just include Anchor Position Animation Closed 6/8/2018 6:00 AM
      1030883 [different behavior] List<T>.LastIndexOf(T) when List<T> is Empty Closed 4/27/2018 6:20 AM