title: The given assembly name was invalid Type.GetType() not working
body: <blockquote>
    <p>Unhandled Exception: System.IO.FileLoadException: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)</p>
  </blockquote>
  
  <p>I am getting an exception from C# in a simple program consisting of two classes, <strong>Program.cs</strong> and <strong>AnotherClass.cs</strong>. I want to use the static <code>Type.GetType</code> method in <strong>Program.cs</strong> to get <code>AnotherClass</code> as a class when given as a string for a more complex program. When I use the following code    </p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          Assembly a = Assembly.GetExecutingAssembly();
          //Console.WriteLine(a.FullName);
          Type t = Type.GetType($"SmallTestingSimulator.{a.FullName}.AnotherClass");
          Console.WriteLine(t.Name);
      }
  }
  </code></pre>
  
  <p>and an empty class in a different file but same namespace</p>
  
  <pre><code>class AnotherClass {
  
  }
  </code></pre>
  
  <p>I get the error. How do I go about using Type.GetType() for another class in this project? Without using the assembly, it gives a NullReferenceException. </p>
  
  <p><em>Related Questions</em></p>
  
  <p><a href="https://stackoverflow.com/questions/1825147/type-gettypenamespace-a-b-classname-returns-null">Type.GetType(&quot;namespace.a.b.ClassName&quot;) returns null</a></p>