Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Exception Accessing MapItem



  • I have a map defined in my application settings as

    {
    "TestMap": "%(val1: foo, val2: bar)"
    }

    and I have a basic plan

    for server MyTestServer
    {
        set $test = $MapItem(%TestMap, val1);
        Execute-PowerShell >>
            $test;
            echo $test;
        >>;
    }
    

    But upon execution I am getting the following stack trace.

    Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object.
       at Inedo.Extensions.VariableFunctions.Maps.MapItemVariableFunction.Evaluate(IGenericBuildMasterContext context)
       at Inedo.BuildMaster.BuildMasterVariableEvaluationContext.TryEvaluateFunction(RuntimeVariableName functionName, IList`1 arguments)
       at Inedo.ExecutionEngine.Variables.FunctionTextValue.Evaluate(IVariableEvaluationContext context)
       at Inedo.ExecutionEngine.Variables.ProcessedString.Evaluate(IVariableEvaluationContext context)
       at Inedo.BuildMaster.Windows.ServiceApplication.Executions.PlanExecuter.DeploymentPlanExecuter.EvaluateExpressionAsync(String expression, IExecuterContext context)
       at Inedo.ExecutionEngine.Executer.ExecuterThread.<EvaluateExpressionAsync>d__73.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Inedo.ExecutionEngine.Executer.ExecuterThread.<ExecuteAsync>d__50.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Inedo.ExecutionEngine.Executer.ExecuterThread.<ExecuteNextAsync>d__34.MoveNext()
    

    What is the correct way to define and access a map?

    Product: BuildMaster
    Version: 5.5.3



  • The way is correct, but it appears there's a bug in the evaluation while accessing the variable; this will be fixed in [BM-2278], which brought code in from Otter that fixes this bug.



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation