Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/Microsoft.ML.Tests/ImagesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ public void MLImageCreationTests(string imageName)
var dataFile = GetDataPath($"images/{imageName}");

using MLImage image1 = MLImage.CreateFromFile(dataFile);
using FileStream imageStream = new FileStream(dataFile, FileMode.Open, FileAccess.Read);
using FileStream imageStream = new FileStream(dataFile, FileMode.Open, FileAccess.Read, FileShare.Read);
using MLImage image2 = MLImage.CreateFromStream(imageStream);

Assert.Equal(image1.Tag, image2.Tag);
Expand Down Expand Up @@ -1333,7 +1333,7 @@ public void MLImageSourceDisposingTest(string imageName)
using MLImage image1 = MLImage.CreateFromFile(imageFile);

// Create image from stream then close the stream and then try to access the image data
FileStream stream = new FileStream(imageFile, FileMode.Open, FileAccess.Read, FileShare.None);
FileStream stream = new FileStream(imageFile, FileMode.Open, FileAccess.Read, FileShare.Read);
MLImage image2 = MLImage.CreateFromStream(stream);
stream.Dispose();
Assert.Equal(image1.Pixels.ToArray(), image2.Pixels.ToArray());
Expand All @@ -1349,7 +1349,7 @@ public void MLImageSourceDisposingTest(string imageName)
image2.Dispose();

// Now test image stream contains image data prepended and appended with extra unrelated data.
stream = new FileStream(imageFile, FileMode.Open, FileAccess.Read, FileShare.None);
stream = new FileStream(imageFile, FileMode.Open, FileAccess.Read, FileShare.Read);
MemoryStream ms = new MemoryStream((int)stream.Length);
for (int i = 0; i < stream.Length; i++)
{
Expand Down