Help: The output char buffer is too small

Hi there,

I am using ReSharper 2.5.x on our current product (with VS2005) and I'm finding that the plugin throws the following exception every time I load my solution. Can someone please tell me how to resolve it, or, at least what is causing the error?

I have searched the newsgroups and found that a number of tickets have been opened for this bug. However, the problem isn't fixed until Resharper 3.x and a description of its cause is not cited in the bug reports. Because our employer has not upgraded to 3.x at the present time, I would at least like to know why it occurs, and what some workarounds might be.

I should note too that I am aware that clearing the cache and re-opening the solution will resolve the bug -- first time around. But once I try to re-open the newly cached project, the same error arises.

Thanks,
Darryl Staflund




JetBrains.ReSharper.Util.InternalErrorException: The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.
Parameter name: chars
An exception has occurred ---> System.ArgumentException: The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.
Parameter name: chars
at System.Text.Encoding.ThrowCharsOverflow()
at System.Text.Encoding.ThrowCharsOverflow(DecoderNLS decoder, Boolean nothingDecoded)
at System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount,
Char* chars, Int32 charCount, DecoderNLS baseDecoder)
at System.Text.DecoderNLS.GetChars(Byte* bytes, Int32 byteCount,
Char* chars, Int32 charCount, Boolean flush)
at System.Text.DecoderNLS.GetChars(Byte[] bytes, Int32 byteIndex,
Int32 byteCount, Char[] chars, Int32 charIndex, Boolean flush)
at System.Text.DecoderNLS.GetChars(Byte[] bytes, Int32 byteIndex,
Int32 byteCount, Char[] chars, Int32 charIndex)
at System.IO.BinaryReader.InternalReadOneChar()
at System.IO.BinaryReader.Read()
at System.IO.BinaryReader.PeekChar()
at
JetBrains.ReSharper.Psi.Util.AbstractPersistentCache`2.LoadData(String
filePath) in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\util\AbstractPersistentCac
he.cs:line 708
at
JetBrains.ReSharper.Psi.Util.AbstractPersistentCache`2.Load(IProgressInd
icator progress) in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\util\AbstractPersistentCac
he.cs:line 626
at
JetBrains.ReSharper.Psi.Impl.Caches2.WordIndex.WordIndexComponent.JetBra
ins.ReSharper.Psi.Caches.ICache.Load() in c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\wordIndex\Wor
dIndexComponent.cs:line 251
at JetBrains.ReSharper.Psi.Impl.Caches2.CompositeCache.Load() in c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\CompositeCach
e.cs:line 70
at
JetBrains.ReSharper.Psi.Impl.Caches2.CacheManagerImpl.LoadCacheJob.Do()
in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\CacheManagerI
mpl.cs:line 229
at JetBrains.ReSharper.Psi.Impl.Caches2.CacheUpdateThread.Run() in c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\CacheUpdateTh
read.cs:line 91
--- End of inner exception stack trace ---

at JetBrains.ReSharper.Util.Logger.LogExceptionEx(Exception,
String, Boolean) in
c:\Agent\work\Server\ReSharper2.5\src\Util\src\Logger.cs:line 350 column
9
at JetBrains.ReSharper.Util.Logger.LogException(Exception) in c:\Agent\work\Server\ReSharper2.5\src\Util\src\Logger.cs:line 362 column
5
at JetBrains.ReSharper.Psi.Impl.Caches2.CacheUpdateThread.Run()
in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\CacheUpdateTh
read.cs:line 95 column 11
at System.Threading.ThreadHelper.ThreadStart_Context(Object)
at System.Threading.ExecutionContext.Run(ExecutionContext,
ContextCallback, Object)
at System.Threading.ThreadHelper.ThreadStart()

4 comments
Comment actions Permalink

Hello Darryl,

do I understand correctly that the problem is not cured by removing caches
folder (prefixed with '_') and there is a consitent way
to repeat it? Thanks.


Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


Hi there,

I am using ReSharper 2.5.x on our current product (with VS2005) and
I'm finding that the plugin throws the following exception every time
I load my solution. Can someone please tell me how to resolve it, or,
at least what is causing the error?

I have searched the newsgroups and found that a number of tickets have
been opened for this bug. However, the problem isn't fixed until
Resharper 3.x and a description of its cause is not cited in the bug
reports. Because our employer has not upgraded to 3.x at the present
time, I would at least like to know why it occurs, and what some
workarounds might be.

I should note too that I am aware that clearing the cache and
re-opening the solution will resolve the bug -- first time around.
But once I try to re-open the newly cached project, the same error
arises.

Thanks,
Darryl Staflund
JetBrains.ReSharper.Util.InternalErrorException: The output char
buffer is too small to contain the decoded characters, encoding
'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.
Parameter name: chars
An exception has occurred ---> System.ArgumentException: The output
char buffer is too small to contain the decoded characters, encoding
'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.
Parameter name: chars
at System.Text.Encoding.ThrowCharsOverflow()
at System.Text.Encoding.ThrowCharsOverflow(DecoderNLS decoder,
Boolean nothingDecoded)
at System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount,
Char* chars, Int32 charCount, DecoderNLS baseDecoder)
at System.Text.DecoderNLS.GetChars(Byte* bytes, Int32 byteCount,
Char* chars, Int32 charCount, Boolean flush)
at System.Text.DecoderNLS.GetChars(Byte[] bytes, Int32 byteIndex,
Int32 byteCount, Char[] chars, Int32 charIndex, Boolean flush)
at System.Text.DecoderNLS.GetChars(Byte[] bytes, Int32 byteIndex,
Int32 byteCount, Char[] chars, Int32 charIndex)
at System.IO.BinaryReader.InternalReadOneChar()
at System.IO.BinaryReader.Read()
at System.IO.BinaryReader.PeekChar()
at
JetBrains.ReSharper.Psi.Util.AbstractPersistentCache`2.LoadData(String
filePath) in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\util\AbstractPersistentC
ac
he.cs:line 708
at
JetBrains.ReSharper.Psi.Util.AbstractPersistentCache`2.Load(IProgressI
nd
icator progress) in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\util\AbstractPersistentC
ac
he.cs:line 626
at
JetBrains.ReSharper.Psi.Impl.Caches2.WordIndex.WordIndexComponent.JetB
ra
ins.ReSharper.Psi.Caches.ICache.Load() in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\wordIndex\W
or
dIndexComponent.cs:line 251
at JetBrains.ReSharper.Psi.Impl.Caches2.CompositeCache.Load() in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\CompositeCa
ch
e.cs:line 70
at
JetBrains.ReSharper.Psi.Impl.Caches2.CacheManagerImpl.LoadCacheJob.Do(
)
in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\CacheManage
rI
mpl.cs:line 229
at JetBrains.ReSharper.Psi.Impl.Caches2.CacheUpdateThread.Run() in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\CacheUpdate
Th
read.cs:line 91
--- End of inner exception stack trace ---
at JetBrains.ReSharper.Util.Logger.LogExceptionEx(Exception,
String, Boolean) in
c:\Agent\work\Server\ReSharper2.5\src\Util\src\Logger.cs:line 350
column
9
at JetBrains.ReSharper.Util.Logger.LogException(Exception) in
c:\Agent\work\Server\ReSharper2.5\src\Util\src\Logger.cs:line 362
column
5
at JetBrains.ReSharper.Psi.Impl.Caches2.CacheUpdateThread.Run()
in
c:\Agent\work\Server\ReSharper2.5\src\Psi\src\impl\caches2\CacheUpdate
Th
read.cs:line 95 column 11
at System.Threading.ThreadHelper.ThreadStart_Context(Object)
at System.Threading.ExecutionContext.Run(ExecutionContext,
ContextCallback, Object)
at System.Threading.ThreadHelper.ThreadStart()



0
Comment actions Permalink

Hi there,

This is true in our project, anyway. If I clear the cache and reload our solution, Resharper will recreate the cache without error. However, once I close the solution and attempt to re-open it (even if do this immediately after recreating the cache), the same exception will be generated by Resharper. Clearing the cache only works for the duration of our development session, it seems.

Darryl

0
Comment actions Permalink

Hi again,

From what we can determine, the problem seems to be tied either to the length of the full pathname of a given file, or to the length of a class' namespace.

In my project, I hold a 1-1 correspondence between the namespace of a class, and the directory containing of the associated sourcefile. If my namespace is 'A.B.C', my directory will be ']]>\A\B\C'.

It's when the namespace gets deep and the corresponding pathnames get long that the 'output char buffer too small' error occurs. For instance, a namespace like the following:

Project.UI.Controls.Editors.TextEditor.Helpers.etc...

with a directory like the following:

c:\ProjectRoot\Project\UI\Controls\Editors\TextEditor\Helpers\etc\Class.cs

would cause Resharper to crash (if it became too long.) Once I flattened my namespace (and corresponding filepaths) and rebuilt the cache, my problems went away.

Hope this helps someone and keeps them from spending a lot of cycles trying to track down this issue.

Darryl

Message was edited by:
Darryl A. J. Staflund

Message was edited by:
Darryl A. J. Staflund

0
Comment actions Permalink

Hello Darryl,

thanks a lot for this information! We'll check the hypothesis with long path
/ namespace names ASAP.
Although I believe that fixed-size buffers aren't used anywhere in code,
and names like 'Project.UI.Controls.Editors.TextEditor.Helpers.etc'
don't seem too long for me as well...


Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


Hi again,

From what we can determine, the problem seems to be tied either to the
length of the full pathname of a given file, or to the length of a
class' namespace.

In my project, I hold a 1-1 correspondence between the namespace of a
class, and the directory containing of the associated sourcefile. If
my namespace is 'A.B.C', my directory will be '<project_root>\A\B\C'.

It's when the namespace gets deep and the corresponding pathnames get
long that the 'output char buffer too small' error occurs. For
instance, a namespace like the following:

Project.UI.Controls.Editors.TextEditor.Helpers.etc...

with a directory like the following:


c:\ProjectRoot\Project\UI\Controls\Editors\TextEditor\Helpers\etc\Clas
s.cs

would cause Resharper to crash (if it became too long.)

Although I like this way of organizing code and find that it conforms
with the class naming conventions of past Java projects that I have
worked on, I flattened out parts of my namespace (and directory
structure) to make Resharper happy. Once I did this and rebuilt the
cache, my problems went away.

Hope this helps someone and keeps them from spending a lot of cycles
trying to track down this issue.

Darryl



0

Please sign in to leave a comment.