Getting error CS1513 and CS1022 while invoking code

Hi,

When I try to run the below code I’m getting this error :

‘No compiled code to run error CS1513: } expected At line 0 error CS1022: Type or namespace definition, or end-of-file expected At line 66’
image

The code is:
class Program
{

public async Task YourAsyncMethod() // Add the 'async' modifier and change return type to 'Task'
{
    var config = new WwsClient.Configuration
    {
        Host = "wd2-impl-services1.workday.com",
        Tenant = "MyCoolTenant",
        UserName = "MyNeatoUser",
        Password = "MyRadPassword"
    };

    using var client = new Financial_ManagementClient(config);

    var ccRefIdType = "Cost_Center_Reference_ID";

    // Build the request
    var req = new Get_Cost_Centers_Request
    {
        Request_References = new Cost_Center_Request_ReferencesType
        {
            Cost_Center_Reference = new[]
            {
                // Use WwsReference utility class to create Workday object references
                WwsReference.Create<Cost_CenterObjectType>(ccRefIdType, "CC1000"),
                WwsReference.Create<Cost_CenterObjectType>(ccRefIdType, "CC2000")
            }
        }
    };

    try
    {
        // Call the web service
        var res = await client.Get_Cost_CentersAsync(req);

        // Inspect the results
        var costCenters = res.Response_Data.Cost_Center.Select(cc => new
        {
            // Use IdOfType extension method to abstract a single ID value
            id = cc.Cost_Center_Reference.IdOfType(ccRefIdType),
            name = cc.Cost_Center_Data.Organization_Data.Organization_Name
        });

        foreach (var cc in costCenters)
        {
            // e.g. "CC1000: My Tubular Cost Center"
            Console.WriteLine($"{cc.id}: {cc.name}");
        }
    }
    catch (WwsException ex)
    {
        // Handle exceptions.
        // The WwsException class contains useful details about
        // validation errors returned by the web service.
        Console.Error.WriteLine($"{ex.FaultCode} occurred.");
        foreach (var err in ex.ValidationErrors)
        {
            Console.Error.WriteLine($"{err.Message} @ {err.XPathExpression}");
        }
    }
}

}

I’ve imported all the relevant namespaces and packages. Could you please help me to figure out where the exact issue is ?

in invoke code defining a method is out of the activity intention concept. We would recommend flattening the code down

Also have a look at the newer introduced coded automation functionality