Main Site Documentation

.Net / TinyCLR: A string is not the string


#1

Trying to port an App from .NETMF to TinyCLR v1.0.0 is saw that the App didn’t run in TinyCLR.
As the reason I found that the declaration of a string led to different results in .Net (.NETMF behaved the same way) and TinyCLR.

string tableName = "TableSample";
        string _accountAccountName = "MyAccount";
        DateTime InstanceDate = DateTime.Now;
string content = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" +
        "<entry xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\"  " +
        "xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\" " +
        "xmlns=\"http://www.w3.org/2005/Atom\"> " +
        "<id>http://" + _accountAccountName + ".table.core.windows.net/Tables('"
            + tableName +
        "')</id>" +
        "<title />" +
        "<updated>" + InstanceDate.ToString("yyyy-MM-ddTHH:mm:ss.0000000Z") + "</updated>" +
        "<author><name/></author> " +
        "<content type=\"application/xml\"><m:properties><d:TableName>" + tableName + "</d:TableName></m:properties></content></entry>";

        string strCopy = content;  // (breakpoint)

In .Net the result was a well formed xml. In TinyCLR the string was truncated.
As I always thought that two contradictory statements cannot both be true…? Whats on here? Different handling of escape sequences? Which result is correct?


#2

So I’m going to guess that the string is only truncated in the display of it in the debugger, but the string itself is fine. You can print it out or check Length to confirm. https://github.com/ghi-electronics/TinyCLR-Ports/issues/169 has the relevant details. This is something we changed in TinyCLR that differs from NETMF.


#3

Yes, I can confirm. The length and the content are the same. I will read your link later.

Thanks