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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=79152 --- shadow/79152 2006-08-24 04:26:44.000000000 -0400 +++ shadow/79152.tmp.27618 2006-08-24 04:26:44.000000000 -0400 @@ -0,0 +1,81 @@ +Bug#: 79152 +Product: Mono: Class Libraries +Version: 1.1 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: CORLIB +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: StringBuilder default ctor does not allocate internal string + +Apparently the default ctor of StringBuilder does not allocate the +internal string, and as a result you get an ArgumentOutOfRangeException +when pinvoking a function with marshalling to StringBuilder: + +Unhandled Exception: System.ArgumentOutOfRangeException: newLength as to +be <= length +Parameter name: newLength + at System.String.InternalSetLength (Int32 newLength) [0x00000] + at System.Text.StringBuilder.ToString () [0x00000] + at Test.LookupSID (System.Byte[] sid, Boolean ansi) [0x00000] + at Test.Main () [0x00000] + +To reproduce, compile and run the attached repro on Windows. + +The repro will invoke both the unicode and ANSI versions of the win32 +LookupAccountSid function. + +Expected result: +================ + +Administrators SID: + +*Unicode* +#B1:14 / 14 +#B2:Administrators +#B3:7 / 7 +#B4:BUILTIN +*ANSI* +#B1:14 / 14 +#B2:Administrators +#B3:7 / 7 +#B4:BUILTIN + +System SID: + +*Unicode* +#B1:6 / 6 +#B2:SYSTEM +#B3:12 / 12 +#B4:NT AUTHORITY +*ANSI* +#B1:6 / 6 +#B2:SYSTEM +#B3:12 / 12 +#B4:NT AUTHORITY + +Actual result: +============== + +Administrators SID: + +*Unicode* +#B1:14 / 14 +#B2:Administrators +#B3:7 / 7 + +Unhandled Exception: System.ArgumentOutOfRangeException: newLength as to +be <= length +Parameter name: newLength + at System.String.InternalSetLength (Int32 newLength) [0x00000] + at System.Text.StringBuilder.ToString () [0x00000] + at Test.LookupSID (System.Byte[] sid, Boolean ansi) [0x00000] + at Test.Main () [0x00000] _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
