title: Read Access Violation this was nullptr error, initilized incorrectly?
body: <p>I am writing a program in C++/CX using the universal windows platform (UWP). I am new at programming and more familiar with regular C++. This is my first time making a UWP app.</p>
  
  <p>The program contains a class called Dress_pack and I have created an instance of it called d in my MainPage.xaml.cpp file.</p>
  
  <p><code>Dress_pack d ("","","");</code></p>
  
  <p>Dress_pack has a member called meas_v which is an IVector of type Platform::String^. Here is my Dress_pack class constructor:</p>
  
  <pre><code>Dress_pack::Dress_pack(Platform::String^ plant = "", Platform::String^    prog = "", Platform::String^ robot = ""){
  plant_no = plant; 
  prog_no = prog;
  robot_no = robot;
  Windows::Foundation::Collections::IVector&lt;Platform::String^&gt;^ meas_v = ref new Platform::Collections::Vector&lt;Platform::String^&gt;();
  Windows::Foundation::Collections::IVector&lt;Platform::String^&gt;^ iss_dis_v = ref new Platform::Collections::Vector&lt;Platform::String^&gt;();}
  </code></pre>
  
  <p>Later in my MainPage.xaml.cpp file I try to append a string to this vector like this:</p>
  
  <pre><code>#include "MainPage.xaml.h"
  #include "dress_pack.h"
  Dress_pack d ("","","");
  
  MainPage::MainPage()
  {
  InitializeComponent();
  d.meas_v-&gt;Append("dk");
  }
  </code></pre>
  
  <p>My MainPage.xaml.h looks like:</p>
  
  <pre><code>#pragma once
  
  #include "MainPage.g.h"
  
  namespace Project_1
  {
  
  public ref class MainPage sealed
  {
  public:
      MainPage();
  
  };  
  
  }
  </code></pre>
  
  <p>My header for Dress_pack contains:</p>
  
  <pre><code>#pragma once
  ref class Dress_pack sealed
  {
  
  public:
      property Platform::String^ plant_no;
      property Platform::String^ prog_no;
      property Platform::String^ robot_no;
      property Windows::Foundation::Collections::IVector&lt;Platform::String^&gt;^ meas_v; property Windows::Foundation::Collections::IVector&lt;Platform::String^&gt;^ iss_dis_v;
  
  //constructor
  Dress_pack(Platform::String^ plant, Platform::String^ prog, Platform::String^ robot);
  
  };
  </code></pre>
  
  <p>But during runtime, the error <code>Exception thrown: read access violation this was nullptr</code> occurs on <code>d.meas_v-&gt;Append("dk");</code>.</p>
  
  <p>During debug, I can see that meas_v contains value nullptr which seems to be the source of the issue. I'm not sure why this is though. Have I initialized my vector incorrectly? Is it some other issue? A push in the right direction would help. Also let me know if you need me to post more code to understand the problem. Thanks!</p>