Reference rewriter: Error

More
8 years 5 months ago #1007 by actraiser
Replied by actraiser on topic Reference rewriter: Error
Hello,

I just encountered the same problem building for WP8.0 on Unity 5.2.1p2

Error: method `System.String System.Globalization.TextInfo::ToTitleCase(System.String)` doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.String I2.Loc.GoogleTranslation::TitleCase(System.String).

I tried overwriting GoogleTranslation.cs with your attached file but it did not change the output. Any other ideas?

Best
–act

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #1008 by Frank
Replied by Frank on topic Reference rewriter: Error
Hi,
There may be an issue with the NETFX_CORE in the latest patch. I will try deploying to wp8 and verify that.

Nonetheless, a quick workaround to fix the issue is to replace line 125 in GoogleTranslation.cs file

from
			#if NETFX_CORE

to
			#if true

That will remove the ToTileCase function and will use a custom version instead.

As soon as I get back I will run the test and add the official fix to 2.7.0b2

Thanks,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago - 8 years 5 months ago #1009 by actraiser
Replied by actraiser on topic Reference rewriter: Error
Hello Frank,

thank you, that was nearly the solution. The code between the #if/#endif block does not work because strings are strictly immutable, so Visual Studio throws an error. I modified the function to use Stringbuilder instead and this worked - also compilation completes successfully. Here is my workaround for the TitleCase-method for anyone needing that fix right away.
public static string TitleCase(string s)
{
    StringBuilder sb = new StringBuilder();
    if (string.IsNullOrEmpty(s))
    {
        return string.Empty;
    } else{

        sb.Append(s);

    }


    #if true
    sb[0] = char.ToUpper(sb[0]);
    for (int i = 1, imax=sb.Length; i<imax; ++i)
    {
        if (char.IsWhiteSpace(sb[i - 1]))
            sb[i] = char.ToUpper(sb[i]);
        else
            sb[i] = char.ToLower(sb[i]);
    }
    return sb.ToString();
    #else
    return System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(sb);
    #endif
}

-act
Last edit: 8 years 5 months ago by actraiser.

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #1014 by Frank
Replied by Frank on topic Reference rewriter: Error
Hi,
Thanks for checking that up.
I will add a similar fix to the next release!

Thanks,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

Time to create page: 0.179 seconds
Template by JoomlaShine