Skip to content

FaceLandmarkListWithIrisAnnotation: Collection was modified; enumeration operation may not execute. #1223

@yuwei-chen-lm

Description

@yuwei-chen-lm

Plugin Version or Commit ID

v0.14.4

Unity Version

2022.3.16

Your Host OS

win11, note book camera

Target Platform

UnityEditor

Target Device

No response

[Windows Only] Visual Studio C++ and Windows SDK Version

No response

[Linux Only] GCC/G++ and GLIBC Version

No response

[Android Only] Android Build Tools and NDK Version

No response

[iOS Only] XCode Version

No response

Build Command

Bug Description

// bug: Collection was modified; enumeration operation may not execute.
// https://stackoverflow.com/questions/604831/collection-was-modified-enumeration-operation-may-not-execute

// change (add ToList() to copy a new list)

in class FaceLandmarkListWithIrisAnnotation.cs:

var enumerator = landmarks.ToList().GetEnumerator();
var faceLandmarks = new List(_FaceLandmarkCount);
for (var i = 0; i < _FaceLandmarkCount; i++)
{
if (enumerator.MoveNext())
{
faceLandmarks.Add(enumerator.Current);
}
}

Steps to Reproduce the Bug

run scene tasks/Face Landmark Detection, sometimes the error occurs

Log

Screenshot/Video

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions