cancel
Showing results for 
Search instead for 
Did you mean: 

Getting error while writing hello world program in c#

venkata_parvata
Level 3
Hi I am just trying to write hello world program in Blue Prism following instructions https://portal.blueprism.com/customer-support/knowledge-base/how-do-i-use-c-code-blue-prism we are getting below 2 errors for below code snippet public class Hello1 { public static void Main() { System.Console.WriteLine("Hello, World!"); } } 1 ) Initialise Stage1 Error Validate Compiler error at top section line 43: Type or namespace definition, or end-of-file expected No 2) Initialise Stage1 Error Validate Compiler error at top section line 7: Identifier expected No Any help is appreciated
8 REPLIES 8

John__Carter
Staff
Staff
VP - the default language is VB.Net, so first make sure you've switched to C#. I don't think you can write to the console like that, maybe a better test would be to use MessageBox, or even just create an output from you code stage that assigns a message value to a data item.

venkata_parvata
Level 3
Hi Carter Modified the language type to C# and code is written in Global code section in Initialize page , even if we tried to put hello world code snippet in other pages still we are getting below error (Attached screenshot for your reference} , request to provide your updates Action 1 Code1 Error Validate Compiler error at line 0: } expected , when we put } the code is valid but at execution time we are getting erorr Thanks VP

venkata_parvata
Level 3
Hi John Request to provide your updates on the above comments Thanks Venkata Parvatam

GertLõhmus
Level 4
Did you also try to save it to a data item on some other page as an output? BluePrism does not really display any console. At least I have not seen it. As John Carter suggested before, try using a data item or MessageBox for displaying it. I do not understand the new error, because why do you get an error that states you need to } when you really have not started with the code yet (on line 0). But I think you need to separate the Constructor and the Method. Try adding public class Hello1 { } and then begin with the Method.

venkata_parvata
Level 3
Hi Gert With above taught implemented , still we are facing the same issue , do you have a simple code stage that could be run on C# , Does anyone able to successfully execute c# or vb code in Blue Prism where I take instructions as mentioned in the said url https://blueprism.knowledgeowl.com/help/article/link/how-do-i-use-c-cod

GertLõhmus
Level 4
I use a lot of VB code. But could you copy all of the code here. So I could check it for any mistakes.

ArchiveUser
Level 4
I am not really familiar with C# coding, but I did the following and it worked: On the Initialise page I added reference to System.Windows.Forms.dll and added namespace System.Windows.Forms This is my global code: class Hello { static void Main() { } public static string HelloWorld() { return ""Hello World!""; } } On another page I added a code stage and this is the code inside it: MessageBox.Show(Hello.HelloWorld()); When ran, it shows the Hello World! message as expected. You can try to reproduce this.

Hi Gert Kindly find attached screenshots for your references and suggest me Where have Global Code in Initialization page and subsequent code stage in other page appreciate your response