cancel
Showing results for 
Search instead for 
Did you mean: 

error in C# code in Global Code tab

Aqibiqbal_khan
Level 2
Hi Guys

Trying a simple Code Snipp of C# in BP. Code is working fine in Visual Studio but throwing error in BP. Attaching my object. Please have a look your help is appriciated.

30431.png
Thanks in Advance


------------------------------
Aqib iqbal khan
Associate Technical
SQS
Asia/Kolkata
------------------------------
4 REPLIES 4

LeonStroschein
Level 3
I might be wrong but, when opening the attached XML, the "foreach: doesn't looked closed in the code that was supplied. Which matches the error message.

 foreach{var Word in scrammbledWord) { Content.Row.Add(Word) }

------------------------------
Leon
------------------------------

Good catch. I think the solution is the other way around because the error has it backwards. The opening curly brace { after the foreach should be an opening parenthesis (.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Hi Dave,

I am facing a similar error in my code but by the good of me can't find where hte missing paranthesis is.Any ideas?

class Credential
{
// accout region, use 'default' value unless being instructed otherwise
private const string d_region = "default";
// Once created each token will be valid only for the following specified period(in seconds).
// This value is ajustable on client side, but note that increasing this value too much
// might not suffice for security concerns, as well as too little value could lead to
// JWT token invalidation before it being received by the beap server due to network delays.
// You can adjust this value for your need or use default value unless you definitely know
// that you need to change this value.
private const int d_lifetime = 25;
/// <summary>
/// Provides access to client id parsed from credential.txt file.
/// </summary>
[JsonProperty("client_id")]
public string ClientId { get; set; }
/// <summary>
/// Accepts client secret form json deserializer and decodes it to bytes.
/// </summary>
[JsonProperty("client_secret")]
public string ClientSecret { set { DecodedSecret = FromHexString(value); } }
/// <summary>
/// Provides access to decoded client secret.
/// </summary>
public byte[] DecodedSecret { get; private set; }
/// <summary>
/// Converts hexadecimal string to bytes.
/// </summary>
/// <param name="s">Input hexadecimal string.</param>
/// <returns></returns>
static private byte[] FromHexString(string input)
{
return Enumerable.Range(0, input.Length)
.Where(charIdx => charIdx % 2 == 0)
.Select(charIdx => Convert.ToByte(input.Substring(charIdx, 2), 16))
.ToArray();
}
/// <summary>
/// Loads credentials from credential.txt file.
/// </summary>
/// <param name="d_credentialPath">Path to credential.txt file.</param>
/// <returns></returns>

------------------------------
Andrei Cozma
Data
Zurich
Europe/Madrid
------------------------------

Looks like you're missing one closing curly brace at the very end to close up the class.

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA