Cannot compile when converting char to string [SOLVED]

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
binaryfish
Posts: 11
Joined: Fri Oct 23, 2015 3:08 am

Cannot compile when converting char to string [SOLVED]

Postby binaryfish » Tue Oct 27, 2015 12:31 am

Hi

I've started to play with cshtml5, if I have a Texbox control and add the code below. If I compile VS will report:

Error 12 'Test.MainPage' does not contain a definition for 'InitializeComponent' and no extension method 'InitializeComponent' accepting a first argument of type 'Test.MainPage' could be found (are you missing a using directive or an assembly reference?) D:\temp\htmlc\Test\MainPage.xaml.cs

Error 9 Compilation stopped due to errors. See other errors for details. Rebuild the project to try again.


Code: Select all

TbxGrid.Text = "Hello";
string test = TbxGrid.Text[0].ToString();



If I comment out

Code: Select all

string test = TbxGrid.Text[0].ToString();
everything works again.

Is this a bug?

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Cannot compile when converting char to string

Postby JS-Support @Userware » Tue Oct 27, 2015 3:28 am

Hi and welcome to the forums.

There is indeed an issue with conversion from char to string. Thanks for reporting it. We are going to fix it asap, likely in the Beta 6.

By the way, please note that the "error 12" that you are getting is not related and it is not the one that is preventing you from compiling successfully. It is related to the XAML designer and we are also attempting to fix it as well, though it will probably not make it for the Beta 6.
But you should also have another error when compiling, that says something like "Error: The method "Char.ToString" is not yet supported. (...)". This is the real error that is preventing you from compiling successfully.

Thanks again.

Regards,
JS-Support

binaryfish
Posts: 11
Joined: Fri Oct 23, 2015 3:08 am

Re: Cannot compile when converting char to string

Postby binaryfish » Tue Oct 27, 2015 3:51 am

But you should also have another error when compiling, that says something like "Error: The method "Char.ToString" is not yet supported. (...)". This is the real error that is preventing you from compiling successfully.

No, I did not get this error message. If I got this message then I would have realised char to string is not supported yet and would have not reported the bug here ;)

Gavin

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Cannot compile when converting char to string

Postby JS-Support @Userware » Fri Oct 30, 2015 11:46 am

Hi,

I am pleased to inform you that the Beta 5.2 of CSHTML5 now allows you to use Char.ToString().

It can be downloaded from:
http://forums.cshtml5.com/viewtopic.php?f=2&t=200

Please feel free to let us know if you still encounter any issues.

Thanks at lot.

Regards,
JS-Support


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 22 guests