yamlizr
yamlizr copied to clipboard
Null pointer exception
Key
- Share your full command line to execute the tool taking care to redact anything private! -yamlizr.exe generate -pat aassddfffffgare53y6fceb7557azkhwtnqim33ergt -org https://dev.azure.com/org1 -proj myproject -out c:/Test/_Devops
- Confirm which version of the tool you are using. Can not find actual version number. Downloaded 22.12.2022
Describe the bug Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ at CasCap.Utilities.YamlPipelineGenerator.GenBuildStage() in //src/CasCap.Apis.AzureDevOps/Utilities/YamlPipelineGenerator.cs:line 112 at CasCap.Utilities.YamlPipelineGenerator.GenPipeline() in //src/CasCap.Apis.AzureDevOps/Utilities/YamlPipelineGenerator.cs:line 67 at CasCap.Commands.GenerateCommand.<>c__DisplayClass31_4.<OnExecuteAsync>g__ProcessDefinition|16(BuildDefinition buildDefinition) in //src/CasCap.DevOpsYamlizrCli/Commands/GenerateCommand.cs:line 241 at CasCap.Commands.GenerateCommand.OnExecuteAsync() in //src/CasCap.DevOpsYamlizrCli/Commands/GenerateCommand.cs:line 223 at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.InvokeAsync(MethodInfo method, Object instance, Object[] arguments) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() --- End of stack trace from previous location --- at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at CasCap.Program.Main(String[] args) in /_/src/CasCap.DevOpsYamlizrCli/Program.cs:line 33 at CasCap.Program.<Main>(String[] args)
Note: It is not only one place as I try to use source code before that time. Did you use the latest API Call? A lot of standard Releases "read" too little values and other parts. For sample, I can see on azure 12 variables but ReleaseDefinition class return only 4.
Please update to 2.0.1 and let me know if still a problem.
I have just installed 2.0.1 and I'm getting a similar issue; I do have Task Groups in my release pipelines and I'm getting this error when I run the tool:
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at CasCap.Utilities.YamlPipelineGenerator.GenSteps(Template template, Dictionary
2 inputs) in /_/src/CasCap.Apis.AzureDevOps/Utilities/YamlPipelineGenerator.cs:line 390
at CasCap.Utilities.YamlPipelineGenerator.GetSteps(Template template, IDictionary2 inputs) in /_/src/CasCap.Apis.AzureDevOps/Utilities/YamlPipelineGenerator.cs:line 386
That line refers to task group values:
var filename = $"{template.taskGroup.Name.Sanitize()}-v{template.taskGroup.Version.Major}.yml";
and all my task group names have spaces in ... they do have versions similar to "1.*" so it could be that too.
Oddly, putting in the --inline
switch allows it to work, but it doesn't put the task groups inline in the pipelines - it still generates the task groups in separate files...
I have no errors in my own integration tests (including with task groups) so I can only suggest that you debug this issue for yourself;
- Clone the repo and open in latest Visual Studio.
- Set CasCap.DevOpsYamlizrCli project as the start-up project.
- Edit the launchSettings.json file with your own details;
{
"profiles": {
"yamlizr": {
"commandName": "Project",
"commandLineArgs": "generate -pat 1111111122222222233333334444444444555555 -org https://dev.azure.com/some_org -proj my_proj -out c:/temp/myoutputfolder"
}
}
}
- Hit Play (in Debug mode) and please create a PR and/or post to this thread when you find the issue.
Note: you can also can install the prior version;
#install last known stable version
dotnet tool update yamlizr --version 1.0.21
#run with old-style arguments (org is a name, not a Uri)
yamlizr generate -pat 1111111122222222233333334444444444555555 -org some_org -proj my_proj -out c:/temp/myoutputfolder
Also getting this error
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.0:00 / 00:00:00
at CasCap.Utilities.YamlPipelineGenerator.GenSteps(Template template, Dictionary`2 inputs) in /_/src/CasCap.Apis.AzureDevOps/Utilities/YamlPipelineGenerator.cs:line 390
One thing that is a possible culprit - the pipeline references an extension that has been removed