title: What causes an interface (or assembly?) to become marked security critical?
body: <h2>Background</h2>
  
  <p>I have a class - <code>MobileLogging</code> - that implements MvvmCross' IMvxTrace interface (from reference Cirrious.MvvmCross.Droid, <code>packages\MvvmCross.HotTuna.CrossCore.3.5.0\lib\MonoAndroid\Cirrious.CrossCore.dll</code>):</p>
  
  <pre><code>namespace Cirrious.CrossCore.Platform
  {
      public interface IMvxTrace
      {
          void Trace(MvxTraceLevel level, string tag, Func&lt;string&gt; message);
          void Trace(MvxTraceLevel level, string tag, string message);
          void Trace(MvxTraceLevel level, string tag, string message, params object[] args);
      }
  }
  </code></pre>
  
  <p>and from a the-code-works-perspective everything is fine. However when choosing "Run Code Analysis on Solution" it produces a lot of security warnings:</p>
  
  <ul>
  <li>CA2140   Transparent code must not reference security critical items</li>
  <li>CA2151   Fields with critical types should be security critical.</li>
  <li>CA2146   Types must be at least as critical as their base types and
  interfaces</li>
  <li>CA2123   Override link demands should be identical to base</li>
  <li>CA2134   Methods must keep consistent transparency when overriding base
  methods</li>
  </ul>
  
  <p>Running SecAnnotate.exe produces a TransparencyAnnotations.xml that contains among other things</p>
  
  <pre><code>  &lt;type name="&lt;...mynamespace...&gt;.MobileLogging"&gt;
      &lt;annotations&gt;
        &lt;critical&gt;
          &lt;rule name="TypesMustBeAtLeastAsCriticalAsBaseTypes"&gt;
            &lt;reason pass="1"&gt;Transparent or safe-critical type 'MobileLogging' derives from
            critical type 'IMvxTrace' in violation of the transparency inheritance rules.
            'MobileLogging' must be critical to derive from a critical type or implement a
            critical interface.&lt;/reason&gt;
            &lt;reason pass="1"&gt;Transparent or safe-critical type 'MobileLogging' derives from
            critical type 'IMobileLogging' in violation of the transparency inheritance
             rules. 'MobileLogging' must be critical to derive from a critical type or
            implement a critical interface.&lt;/reason&gt;
          &lt;/rule&gt;
        &lt;/critical&gt;
      &lt;/annotations&gt;
  </code></pre>
  
  <p>At first I just assumed that ok, the logging functions are supposed to possibly at some point possibly call some native (unmanaged) logging function, so it does not seem too far off that this is marked as security critical. But now I am beginning to think that the fact that IMvxTrace is considered security critical is wrong.</p>
  
  <p>First of all because when looking into the <a href="https://github.com/MvvmCross/MvvmCross/" rel="noreferrer">MvvmCross' code base</a> there is nothing there that indicates any specifications of security level or anything, in fact searching for the string "secur" only matches two lines</p>
  
  <pre><code>SecureTextEntry = isPassword,
  using System.Security.Cryptography;
  </code></pre>
  
  <p>And searching for "IMvxTrace critical" on google returns only 5 matches, none of which is relevant to me.</p>
  
  <h2>Question</h2>
  
  <p>So, assuming that IMvxTrace is erroneously marked as security critical, what are possible causes for this and how do I fix that?</p>