Page 1 of 1

Cannot compile when converting char to string [SOLVED]

Posted: Tue Oct 27, 2015 12:31 am
by binaryfish
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?

Re: Cannot compile when converting char to string

Posted: Tue Oct 27, 2015 3:28 am
by JS-Support @Userware
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

Re: Cannot compile when converting char to string

Posted: Tue Oct 27, 2015 3:51 am
by binaryfish
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

Re: Cannot compile when converting char to string

Posted: Fri Oct 30, 2015 11:46 am
by JS-Support @Userware
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