Bug 4162 - StringBuilder.Append(string) fails
Summary: StringBuilder.Append(string) fails
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-30 14:15 UTC by Dylan Borg
Modified: 2012-03-30 14:24 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 GitHub or Developer Community 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.

Related Links:
Status:
RESOLVED FIXED

Description Dylan Borg 2012-03-30 14:15:15 UTC
Calling StringBuilder.Append with a string paramater fails in Mono 2.11 as in the below example:

dylan@ubuntu-server:/var/www/Code/dylannet/dncollections$ mono testcoll.exe
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) object.__icall_wrapper_mono_string_alloc (intptr) <0xffffffff>
  at (wrapper alloc) object.Alloc (intptr,int) <0xffffffff>
  at System.Text.StringBuilder.InternalEnsureCapacity (int) <0x0009d>
  at System.Text.StringBuilder.Append (string) <0x00082>
  at dylan.NET.Collections.ALList.ToString () <0x0008f>
  at testcoll.Program.main () <0x000a7>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	mono() [0x80e9034]
	mono() [0x8130bec]
	mono() [0x8060fdd]
	[0xb773640c]
	mono() [0x8238a69]
	mono() [0x8238bbd]
	mono() [0x823fa94]
	mono(mono_string_new_size+0x45) [0x81b88f5]
	mono() [0x81b8998]
	[0xb72f7815]
	[0xb72f77dc]
	/usr/local/lib/mono/4.5/mscorlib.dll.so(+0x28acfe) [0xb3471cfe]
	/usr/local/lib/mono/4.5/mscorlib.dll.so(+0x289d43) [0xb3470d43]
	[0xb72f7578]
	[0xb72f6d78]
	[0xb72f6e2e]
	mono() [0x806562c]

Debug info from gdb:

Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted (core dumped)
Comment 1 Dylan Borg 2012-03-30 14:24:51 UTC
I had something wrong in the code that caused an unnecessarily large space allocation for the string.