- Home /
GUID variable declaration error
Hi,
I'm having trouble with passing a Guid into a method of a webservice.
I declare this variable:
Guid guidID = new Guid("CA761232-ED42-11CE-BACD-00AA0057B223");
However, I get the following error:
error CS0246: The type or namespace name `Guid' could not be found. Are you missing a using directive or an assembly reference?
Does anyone have any idea how to fix this issue?
Thanks in advance :)
Answer by Wolfram · Jan 31, 2013 at 11:02 PM
Guid is in the System namespace, so either add using System; at the top of your script, or use System.Guid(...).
If you already did that, try changing in the Player Settings the entry saying ".NET 2.0 subset" to ".NET 2.0".
That fixed that problem thank you ... however I now get the error:
FormatException: Invalid format for Guid.Guid(string).
Any ideas on what I am doing wrong?
Are you sure that your Guid string that you provide follows one of `the accepted formats?
Do you really use a constant literal string like in the example above, or do you read the string in from somewhere? $$anonymous$$aybe there's a space / newline / ... char somewhere.
I am fairly certain it follows the accepted formats.
Here is my full code:
string sX$$anonymous$$L = " ";
Guid sessionID = Guid.Empty;
Guid guidID = new Guid("CA761232-ED42-11CE-BACD-00AA0057B223");
sX$$anonymous$$L = client.GetXml(sessionID, guidID );
There are no spaces or newlines anywhere.
Can you see anything wrong with this?
Your answer