Skip to content

[ 6.0.100-preview.6.21321.10] Attempted to read past the end of the stream error in QuickInfo app #54538

@Junjun-zhao

Description

@Junjun-zhao

Application Name: QuickInfo
OS: Windows 10 RS5
CPU: X64
.NET Build Number: 6.0.100-preview.6.21321.10

Verify Scenarios:

  1. Windows 10 RS5 X64 + dotnet-sdk-3.1.411 PASS
  2. Windows 10 RS5 X64 + 6.0.100-preview.6.21315.23 PASS
  3. Windows 10 RS5 X64 + 6.0.100-preview.6.21321.10: Fail

Github Link : https://github.com/KirillOsenkov/QuickInfo
Source Code & App check at : https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1345781

Minimal Repro steps:

This is 3.1 app, but we are running it on 6.0, machine only have 6.0 installed, and DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2, so it runs on 6.0

1)Copy App to machine
2) dotnet QuickInfoWeb.dll
3) Navigate to https://localhost:5001/
4) In the textbox, type color

Expected Result:
It should display colors

Actual Result:

System.TypeInitializationException: The type initializer for 'QuickInfo.Controllers.AnswersController' threw an exception. ---> 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> 
System.TypeInitializationException: The type initializer for 'System.Unicode.UnicodeInfo' threw an exception. ---> 
System.IO.EndOfStreamException: Attempted to read past the end of the stream. at 
System.Unicode.UnicodeData.ReadUnicodeCharacterDataEntry(BinaryReader reader, Byte[] nameBuffer, UnicodeCharacterData& 
value) in UnicodeInformation.dll:token 0x6000083+0x73 at System.Unicode.UnicodeData.ReadFromStream(Stream stream) in 
UnicodeInformation.dll:token 0x6000082+0xbd at System.Unicode.UnicodeData.ReadFromResources() in 
UnicodeInformation.dll:token 0x6000081+0x26 at System.Unicode.UnicodeInfo..cctor() in UnicodeInformation.dll:token 
0x600009e+0x38 --- End of inner exception stack trace --- at System.Unicode.UnicodeInfo.GetBlocks() in  
UnicodeInformation.dll:token 0x600009d+0x0 at QuickInfo.Unicode.BuildUnicodeList() in 
C:\Users\appcompat\QuickInfo\src\QuickInfo\Processors\Unicode.cs:line 183 at QuickInfo.Unicode..ctor() in 
C:\Users\appcompat\QuickInfo\src\QuickInfo\Processors\Unicode.cs:line 21 at 
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) in 
System.Private.CoreLib.dll:token 0x6000687+0x43 --- End of inner exception stack trace --- at 
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) in 
System.Private.CoreLib.dll:token 0x6000687+0x66 at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean 
wrapExceptions) in System.Private.CoreLib.dll:token 0x60009a9+0x2d at System.Activator.CreateInstance(Type type) in 
System.Private.CoreLib.dll:token 0x60009a0+0x0 at QuickInfo.Engine.<>c.<.ctor>b__2_1(Type t) in 
C:\Users\appcompat\QuickInfo\src\QuickInfo\Engine.cs:line 28 at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() in System.Linq.dll:token 0x6000244+0x3a at 
System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) in System.Private.CoreLib.dll:token 
0x6006883+0xea at QuickInfo.Engine..ctor(Assembly[] assemblies) in C:\Users\appcompat\QuickInfo\src\QuickInfo\Engine.cs:line 28 at QuickInfo.Controllers.AnswersController..cctor() in C:\Users\appcompat\QuickInfo\src\QuickInfoWeb\Controllers\AnswersController.cs:line 40 --- End of inner exception stack trace --- at QuickInfo.Controllers.AnswersController.get_Instance() in C:\Users\appcompat\QuickInfo\src\QuickInfoWeb\Controllers\AnswersController.cs:line 40 at QuickInfo.Controllers.AnswersController.Get(String query) in 
C:\Users\appcompat\QuickInfo\src\QuickInfoWeb\Controllers\AnswersController.cs:line 20

Findings :

We think error is related to System.IO.Compression.dll, when we replace it with working version, app works fine.

For minimal app repro :

Error is coming from nuget this package :
Library source code : GitHub - GoldenCrystal/NetUnicodeInfo: Unicode Character Inspector & Library providing a subset of the Unicode data for .NET clients.

This code will work on .net5 but throws exception on .net6

  1. create console app (net5 or net6), but we need to run it on net6
  2. Add this package : <PackageReference Include="UnicodeInformation" Version="2.5.0" />
  3. Add this code in program.cs :
                var test = UnicodeInfo.GetBlocks();
                foreach (var item in test)
                {
                        Console.WriteLine(item.Name);
                 }

Exception :

Unhandled exception. System.TypeInitializationException: The type initializer for 'System.Unicode.UnicodeInfo' threw an exception.
 ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
   at System.Unicode.UnicodeData.ReadUnicodeCharacterDataEntry(BinaryReader reader, Byte[] nameBuffer, UnicodeCharacterData& value) in UnicodeInformation.dll:token 0x6000083+0x73
   at System.Unicode.UnicodeData.ReadFromStream(Stream stream) in UnicodeInformation.dll:token 0x6000082+0xbd
   at System.Unicode.UnicodeData.ReadFromResources() in UnicodeInformation.dll:token 0x6000081+0x26
   at System.Unicode.UnicodeInfo..cctor() in UnicodeInformation.dll:token 0x600009e+0x38
   --- End of inner exception stack trace ---
   at System.Unicode.UnicodeInfo.GetBlocks() in UnicodeInformation.dll:token 0x600009d+0x0
   at TestApp6.Program.Main(String[] args) in C:\Users\appcompat\source\repos\TestApp6\TestApp6\Program.cs:line 10

@dotnet-actwx-bot @dotnet/compat

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions