diff --git a/build/NetFrameworkRelease.targets b/build/NetFrameworkRelease.targets
index 2d59f6848..10496641b 100644
--- a/build/NetFrameworkRelease.targets
+++ b/build/NetFrameworkRelease.targets
@@ -29,7 +29,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/AccessibilityInsights.SharedUx/Highlighting/Win32SnapshotButton.cs b/src/AccessibilityInsights.SharedUx/Highlighting/Win32SnapshotButton.cs
index 03f48337a..c8da06a02 100644
--- a/src/AccessibilityInsights.SharedUx/Highlighting/Win32SnapshotButton.cs
+++ b/src/AccessibilityInsights.SharedUx/Highlighting/Win32SnapshotButton.cs
@@ -104,7 +104,16 @@ private static PrivateFontCollection LoadFontResource()
try
{
byte[] fontdata = new byte[fontStream.Length];
- fontStream.Read(fontdata, 0, (int)fontStream.Length);
+ int bytesRead = 0;
+ while (bytesRead < fontdata.Length)
+ {
+ int read = fontStream.Read(fontdata, bytesRead, fontdata.Length - bytesRead);
+ if (read <= 0)
+ {
+ throw new EndOfStreamException("Unexpected end of stream");
+ }
+ bytesRead += read;
+ }
Marshal.Copy(fontdata, 0, data, (int)fontStream.Length);
fonts.AddMemoryFont(data, (int)fontStream.Length);
}