Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
it's impossible to search for the string "true" (including the quote marks) inside MonoDevelop as it throws an exception.
I have 'include binary files' enabled which is causing this error to happen as MD opens *every* file as if it were valid UTF8. To be honest, this behaviour is broken. Binary files need to be opened as binary. We might be able to work around it by using a non-throwing version of UTF8Encoding when creating the StreamReader, but this particular bug may still happen as the exception happens before the converter tries converting the bytes to actual characters.
Parameter name: chars
at System.Text.UTF8Encoding.InternalGetChars (System.Byte* bytes, Int32 byteCount, System.Char* chars, Int32 charCount, System.UInt32& leftOverBits, System.UInt32& leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer& fallbackBuffer, System.Byte& bufferArg, Boolean flush) [0x00000] in <filename unknown>:0
at 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, System.Byte& bufferArg, Boolean flush) [0x00000] in <filename unknown>:0
at System.Text.UTF8Encoding+UTF8Decoder.GetChars (System.Byte bytes, Int32 byteIndex, Int32 byteCount, System.Char chars, Int32 charIndex) [0x00000] in <filename unknown>:0
at System.IO.StreamReader.ReadBuffer () [0x00000] in <filename unknown>:0
at System.IO.StreamReader.Read (System.Char buffer, Int32 index, Int32 count) [0x00000] in <filename unknown>:0
at System.IO.StreamReader.ReadToEnd () [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.FindInFiles.FileProvider.BeginReplace () [0x00015] in /Users/alanmcgovern/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FileProvider.cs:114
at MonoDevelop.Ide.FindInFiles.FindReplace+<FindAll>c__IteratorA.MoveNext () [0x0016e] in /Users/alanmcgovern/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindReplace.cs:94
at MonoDevelop.Ide.FindInFiles.FindInFilesDialog.SearchReplace (System.String replacePattern) [0x001d0] in /Users/alanmcgovern/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindInFilesDialog.cs:567
1) How should we search binary files
2) How should we handle text files which throw an exception when reading them during search. Skip them or abort the search?
Not sure why we're reading entire files into memory instead of streaming. Do we have some cap of the size of files we read?
We should use MD's TextFile API to autodetect the encoding.
Detecting the encoding using the TextFile API would be great for text files, but we still shouldn't really be opening binary files as any kind of text as we're going to hit the issue as described above. Maybe this is a bug in UTF8Encoding.InternalGetChars and this crash shouldn't happen, but currently it does break binary file searching within MD.
This has been fixed already