 <p>This line is throwing the "Ambiguous match found" exception:</p> <pre><code> var trimMethod = typeof(string).GetMethod("Trim"); </code></pre> <p>Change it to:</p> <pre><code>var trimMethod = typeof(string).GetMethod("Trim", new Type[0]); </code></pre>