title: Sequence contains no Elements at System.Linq.Enumerable.Single[Tsource](IEnumerable'1 source)
body: <p>I am running some test and using OpenXML now I want to get the data into an Array and save to their respective content controls. I tried and I am getting this execption</p>
  
  <pre><code>Sequence contains no Elements at System.Linq.Enumerable.Single[Tsource](IEnumerable'1 source)
  </code></pre>
  
  <p>With this source code :</p>
  
  <pre><code>using DocumentFormat.OpenXml;
  using DocumentFormat.OpenXml.Packaging;
  using DocumentFormat.OpenXml.Wordprocessing;
  using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace PopulateContentsOpenXml
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              string myfile = @"C:\Users\*****\Desktop\DTestDoc.docx";
              string[] writeDocData = new string[] {FirstName.Text,FileNumber.Text,IDNumber.Text,LastName.Text };
              WriteDataToContentControl(myfile, writeDocData);
          }
  
          private void WriteDataToContentControl(string filename,string[]data)
          {
              try
              {
                  using (WordprocessingDocument doc = WordprocessingDocument.Open(filename, true))
                  {
                      MainDocumentPart mainPart = doc.MainDocumentPart;
                      foreach (string text in data) 
                      {
                          SdtElement text_block = mainPart.Document.Body.Descendants&lt;SdtElement&gt;().Where(r =&gt; r.SdtProperties.GetFirstChild&lt;Tag&gt;().Val == text).Single();
                          Text to = text_block.Descendants&lt;Text&gt;().Single();
                          to.Text = text;
                          mainPart.Document.Save();
                          MessageBox.Show("Ok i am fine now!");
                      }
                  }
              }
              catch (Exception ex)
              {
                  MessageBox.Show("Error: " + ex.ToString());
              }
          }
      }
  }
  </code></pre>
  
  <p>And i am getting the Exception on line 39 which is this line </p>
  
  <pre><code>SdtElement text_block = mainPart.Document.Body.Descendants&lt;SdtElement&gt;().Where(r =&gt; r.SdtProperties.GetFirstChild&lt;Tag&gt;().Val == text).Single();
  </code></pre>
  
  <p><strong>Edits</strong>
  Doing this </p>
  
  <pre><code>        SdtElement text_block = mainPart.Document.Body.Descendants&lt;SdtElement&gt;().Where(r =&gt; r.SdtProperties.GetFirstChild&lt;Tag&gt;().Val == text).SingleOrDefault();
  
          Text to = text_block.Descendants&lt;Text&gt;().Single();
  </code></pre>
  
  <p>I am having Object not set to instance of an object. now having checked, it says text_block is null</p>
  
  <p>Why is this so?</p>