Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 690d871

Browse files
committed
Fix new String(new Char[0])
1 parent 43e9082 commit 690d871

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CLR/Libraries/CorLib/corlib_native_System_String.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ HRESULT Library_corlib_native_System_String::FromCharArray( CLR_RT_StackFrame& s
548548
CLR_UINT32 len;
549549

550550
array = stack.Arg1().DereferenceArray(); if(!array) TINYCLR_SET_AND_LEAVE(S_OK);
551-
len = array->m_numOfElements ; if(!len ) TINYCLR_SET_AND_LEAVE(S_OK);
551+
len = array->m_numOfElements ;
552552

553553
if(length == -1) length = len - startIndex;
554554

Test/Platform/Tests/CLR/mscorlib/systemlib/systemlib2/SystemStringTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ public MFTestResults Ctor_Test()
5757
char[] car2 = new char[] { (char)0, (char)65};
5858
string s = new string(car2);
5959
testResult &= (s == "\0A");
60-
6160
Log.Comment("This was previously bug 20620");
61+
62+
Log.Comment("new char[0]");
63+
str = new string(new char[0]);
64+
testResult &= (str == string.Empty);
65+
6266
return (testResult ? MFTestResults.Pass : MFTestResults.Fail);
6367
}
6468
[TestMethod]

0 commit comments

Comments
 (0)