Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null pointer exception #177

Open
AlexNek opened this issue Dec 22, 2022 · 5 comments
Open

Null pointer exception #177

AlexNek opened this issue Dec 22, 2022 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@AlexNek
Copy link

AlexNek commented Dec 22, 2022

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.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.<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.

(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.

@AlexNek AlexNek added the bug Something isn't working label Dec 22, 2022
@f2calv
Copy link
Owner

f2calv commented Dec 27, 2022

Please update to 2.0.1 and let me know if still a problem.

@daj102
Copy link

daj102 commented Jan 2, 2023

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, Dictionary2 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.

@daj102
Copy link

daj102 commented Jan 3, 2023

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...

@f2calv
Copy link
Owner

f2calv commented Jan 11, 2023

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;

  1. Clone the repo and open in latest Visual Studio.
  2. Set CasCap.DevOpsYamlizrCli project as the start-up project.
  3. 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"
    }
  }
}
  1. 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

@f2calv f2calv added the help wanted Extra attention is needed label Jan 11, 2023
@flcdrg
Copy link

flcdrg commented Apr 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants