-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Mono throws exception with text GetCPInfoExW opening binary file #12603
Description
Steps to Reproduce
This was found attempting to get the C# semantic tests running on Mono
- Clone https://github.com/jaredpar/roslyn
- Run
./build.sh --restore --build - Run
cd src/Compilers/CSharp/Test/Symbol - Run
dotnet msbuild /t:Test /p:TestRuntime=Mono
Actual Behavior
This will run the Symbol unit tests and eventually Mono will fail executing the test FileThatCannotBeDecoded.
Expected Behavior
The test passes
On which platforms did you notice this
This was discovered on Ubuntu 18.04. I'm using the latest nightly mono as described by the Download page
2019-01-24T17:00:15.7166214Z Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
2019-01-24T17:00:15.7166659Z TLS: __thread
2019-01-24T17:00:15.7166780Z SIGSEGV: altstack
2019-01-24T17:00:15.7166881Z Notifications: epoll
2019-01-24T17:00:15.7166949Z Architecture: amd64
2019-01-24T17:00:15.7166998Z Disabled: none
2019-01-24T17:00:15.7167048Z Misc: softdebug
2019-01-24T17:00:15.7167112Z Interpreter: yes
2019-01-24T17:00:15.7167163Z LLVM: yes(600)
2019-01-24T17:00:15.7167211Z Suspend: hybrid
2019-01-24T17:00:15.7167261Z GC: sgen (concurrent by default)
Note: the mono version is no longer being printed out anymore where it used to be. Hence I'm unsure exactly which nightly package is being used but it was done the morning of 1/24/2019
Full Details
This is a test of the C# compilers ability to detect binary files and not attempt to fully parse them. The binary file in this case is created with the content new byte[] { 0xd8, 0x00, 0x00, 0x00 }.
When reading the string the compiler the compiler uses a StreamReader instance. The first attempt in this test will allow the reader to detect the encoding of the file which will fail and should throw a DecoderFallbackException. The second attempt will use ASCII encoding for reading the file and should return a string of length 4 with the characters new char[] { 216, 0, 0, 0 }. The compiler will then interpret the consecutive 0 elements as binary.
The Mono runtime though is throwing an unexpected exception on this code path with the Message property having the text "GetCPInfoExW". This is unexpected and causes us to fall back to a different error message: source file not found.