Description
System Information:
- OS & Version: Windows 11
- ML.NET Version: ML.NET v4.0.2
- .NET Version: .NET 9.0
Describe the bug
In some cases MLImage disposes after CreateEnumerable .ToArray() if there is ResizeImages in the pipeline.
If SourceImage size == ResizedImage size, after CreateEnumerable .ToArray() SourceImage disposes.
If SourceImage size != ResizedImage size, after CreateEnumerable .ToArray() SourceImage doesn't dispose.
To Reproduce
Project with xUnit and reproduction:
https://github.com/Lavshyak/MLNetImageDisposingProblem
Expected behavior
Provide a choice whether to dispose or not. If not, then SourceImage doesn't dispose.
Or just never dispose.
Or just write about it in red text in the documentation.
Screenshots, Code, Sample Projects
Project with xUnit and reproduction:
https://github.com/Lavshyak/MLNetImageDisposingProblem