Answers: <p>That is possible if your yaml does not exist in the source or target gat branch. The build tries to run but can not fetch the yaml in the downloaded source code. If you create your yaml only on master ... do not forget to merge it through other branches.</p>
  
Answers: CC BY-SA 4.0
Answers: 2024-02-16T15:17:56.677Z
Answers: 2024-02-16T15:17:56.677Z
Answers: Shamrai Aleksander
Body: <p>This (nearly empty) Azure DevOps pipeline yaml fails when initiated because of a PR from another repo's Build Validation:</p>
  <p><strong>azure-pipelines.yaml</strong> of &quot;App A&quot;:</p>
  <pre class="lang-yaml prettyprint-override"><code>pool:
    name: default
  
  steps:
  - bash: |
      echo &quot;##[debug]Because&quot;
    displayName: 'log stuff'
  </code></pre>
  <p><a href="https://i.sstatic.net/W3qb4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/W3qb4.png" alt="Build Validation" /></a></p>
  <p>Normal build validation of a pipeline pointing at the same repo works (&quot;Common Gated&quot; as this is a policy for the &quot;Common&quot; repo), but running App A's pipeline as a Build Validation, it errors out immediately with little detail.  App A's pipeline works fine when triggered manually.  (App B is all exactly the same)</p>
  <p><a href="https://i.sstatic.net/7VSnP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7VSnP.png" alt="&quot;View 3 Checks&quot;" /></a></p>
  <p><a href="https://i.sstatic.net/vBygN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vBygN.png" alt="An error occurred while loading the YAML build pipeline. Object reference not set to an instance of an object." /></a></p>
  <blockquote>
  <p>An error occurred while loading the YAML build pipeline. Object reference not set to an instance of an object. <br />2125292</p>
  </blockquote>
  <p>In case I'm at the wrong tree, what I'm trying to do is a gated build of both App A and App B when attempting to update Common's main branch.  App A and App B each have git-submodules of Common embedded in them - an experiment to avoid publishing packages and versioning of Common without sacrificing much overall code/build stability. Ultimately, I think I'll need to switch the gated build's Common submodule branch to <code>$(System.PullRequest.SourceBranch)</code> before this check will make any sense, but I'm not that far along.  Anyone succeeded in such a setup?</p>
  
Tags: <azure-devops><git><azure-pipelines><build-pipeline><tfs>
Title: Azure DevOps Build Validation of other repo's pipeline: "while loading the YAML build pipeline. Object reference not set to an instance of an object."
UserDisplayName: Jason Kleban
ThreadText: # Azure DevOps Build Validation of other repo's pipeline: "while loading the YAML build pipeline. Object reference not set to an instance of an object."
  
  (Asked by: username_0 on 2023-02-15)
  
  This (nearly empty) Azure DevOps pipeline yaml fails when initiated because of a PR from another repo's Build Validation:
  
  **azure-pipelines.yaml** of "App A":
  
  ```yaml
  pool:
    name: default
  
  steps:
  - bash: |
      echo "##[debug]Because"
    displayName: 'log stuff'
  
  ```
  
  [![Build Validation](https://i.sstatic.net/W3qb4.png)](https://i.sstatic.net/W3qb4.png)
  
  Normal build validation of a pipeline pointing at the same repo works ("Common Gated" as this is a policy for the "Common" repo), but running App A's pipeline as a Build Validation, it errors out immediately with little detail. App A's pipeline works fine when triggered manually. (App B is all exactly the same)
  
  [!["View 3 Checks"](https://i.sstatic.net/7VSnP.png)](https://i.sstatic.net/7VSnP.png)
  
  [![An error occurred while loading the YAML build pipeline. Object reference not set to an instance of an object.](https://i.sstatic.net/vBygN.png)](https://i.sstatic.net/vBygN.png)
  
  > An error occurred while loading the YAML build pipeline. Object reference not set to an instance of an object.   
  > 2125292
  
  In case I'm at the wrong tree, what I'm trying to do is a gated build of both App A and App B when attempting to update Common's main branch. App A and App B each have git-submodules of Common embedded in them - an experiment to avoid publishing packages and versioning of Common without sacrificing much overall code/build stability. Ultimately, I think I'll need to switch the gated build's Common submodule branch to `$(System.PullRequest.SourceBranch)` before this check will make any sense, but I'm not that far along. Anyone succeeded in such a setup?
  
  **Tags:** azure-devops, git, azure-pipelines, build-pipeline, tfs
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-02-16. Score: 0
  
  That is possible if your yaml does not exist in the source or target gat branch. The build tries to run but can not fetch the yaml in the downloaded source code. If you create your yaml only on master ... do not forget to merge it through other branches.
  
  
  ---
  
  