[Mono-bugs] [Bug 79541][Blo] New - Using StreamReader gets an exception

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Oct 1 04:03:32 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jwiegley at gmail.com.


--- shadow/79541	2006-10-01 04:03:32.000000000 -0400
+++ shadow/79541.tmp.14553	2006-10-01 04:03:32.000000000 -0400
@@ -0,0 +1,73 @@
+Bug#: 79541
+Product: Mono: Class Libraries
+Version: 1.1
+OS Details: OS/X 10.4.8
+Status: NEW   
+Priority: Blocker
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: jwiegley at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Using StreamReader gets an exception
+Please fill in this template when reporting a bug, unless you know what you are doing.
+Description of Problem:
+I'm using StreamReader to scan lines in a file, however at a certain point in the file it triggers the 
+following exception:
+Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out of range.
+Parameter name: index
+in [0x0006b] (at /private/tmp/scratch/mono-
+System.Text.DecoderReplacementFallbackBuffer:Fallback (System.Byte[] bytesUnknown, Int32 
+in [0x00036] (at /private/tmp/scratch/mono-
+UTF8Encoding.cs:549) System.Text.UTF8Encoding:Fallback (System.Object provider, 
+System.Text.DecoderFallbackBuffer buffer, System.Byte[] bytes, Int32 byteIndex, System.Char[] 
+chars, System.Int32 charIndex)
+in [0x0038b] (at /private/tmp/scratch/mono-
+UTF8Encoding.cs:734) System.Text.UTF8Encoding:InternalGetChars (System.Byte[] bytes, Int32 
+byteIndex, Int32 byteCount, System.Char[] chars, Int32 charIndex, System.UInt32 leftOverBits, 
+System.UInt32 leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer 
+fallbackBuffer, Boolean flush)
+in [0x00019] (at /private/tmp/scratch/mono-
+UTF8Encoding.cs:908) System.Text.UTF8Encoding+UTF8Decoder:GetChars (System.Byte[] bytes, 
+Int32 byteIndex, Int32 byteCount, System.Char[] chars, Int32 charIndex)
+in [0x000a1] (at /private/tmp/scratch/mono-
+StreamReader.cs:320) System.IO.StreamReader:ReadBuffer ()
+in [0x000cd] (at /private/tmp/scratch/mono-
+StreamReader.cs:425) System.IO.StreamReader:ReadLine ()
+in [0x00050] (at /Users/johnw/Desktop/split-lg.cs:20) LightsOfGuidance.SplitBook:Main 
+(System.String[] args)
+I've seen this problem before, but never had an easy reproducible case.  The thing about this 
+case is that it's so simple.
+Steps to reproduce the problem:
+1. Download lg.txt from http://johnwiegley.com/lg.txt.bz2
+2. Download split-lg.cs from http://johnwiegley.com/split-lg.cs.bz2
+3. Built split-lg.exe, and run it like this: mono split-lg.exe lg.txt
+Actual Results:
+On my machine, this script fails at entry "268".  Since this script is so simple, and isn't doing 
+anything complicated, I can't see any reason why it should fail at this point instead of before.
+Expected Results:
+I expect it to get through the file cleanly.
+How often does this happen? 
+Every time I run it.
+Additional Information:
+I'm using on a PPC Mac.

More information about the mono-bugs mailing list