Video Screencast Help

Invalid name : Name cannot be 'switch'.

Created: 31 Jul 2012 | 4 comments

I am trying to create a new webservice component with our Egenera Pan Maneger SDK. I got the following error when I try to save and compile the new WS.

 

Names error in namespace 'PWSServiceDynamicService'. Error : Invalid  name : Name cannot be 'switch'.

 

I see where the name was called 'switch' so how do I change it? If I try to delete it, the component will save but toss errors when I try to compile.

Comments 4 CommentsJump to latest comment

reecardo's picture

You probably have a parameter to a web service method called switch. This is a reserved word in C# and thus not allowed. You should be able to change the name of the parameter on the last page of the generator. The last page displays the methods selected with each parameter and lets you change them.

If you cna't find what I'm describing, send me the source of the generated code. This can be accessed by clicking Advanced Settings - Save Source Code in the generator (where you can click Compile and Close).

noodleNT's picture

The problem is the name "Switch" is used as a name of a Method. So I can't even change it or save the component with it in there. Now I can delete the method before saving. It still wont let me compile but I can see the source code then. Would that work?

reecardo's picture

Is the name of the method "Switch" or "switch" (note the case)... as the generator should allow the former but not the latter.

Deleting the method might work. It could be that the generator is having difficulty throwing away everything related to "switch". You might have to rebuild the generator froms scratch if it can't.

I'm checking the code to see if we do have an issue with method names and C# reserved words... we def. do for parameters, but I'm not sure about methods names.

Until then, note to all web service developers: stop naming your web service methods with c# reserved words :)