Getting error while writing hello world program in c#
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-06-16 11:00 AM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-06-16 05:09 PM
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
28-06-16 09:55 AM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
29-06-16 03:53 PM
Hi John
Request to provide your updates on the above comments
Thanks
Venkata Parvatam
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
29-06-16 04:44 PM
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-06-16 05:41 PM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-07-16 12:14 PM
I use a lot of VB code. But could you copy all of the code here. So I could check it for any mistakes.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-07-16 01:34 PM
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-07-16 01:54 PM
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
