title: Application installed from Test flight crashes in real device, while working fine in Simulator Xamarin.Forms iOS 13.6
body: <p>I have recently update my OS to macOSCatalina 10.15.6 and Xcode to 11.6 version to support the latest Xamarin.iOS version 13.18.3.2 (Visual Studio Community).</p>
  <p>I have implemented LinkedIn Login in my app, when I click on the LinkedIn login option it calls the iOS renderer I have created and runs the below code:</p>
  <pre><code>var rc = UIApplication.SharedApplication.KeyWindow.RootViewController;
  
  var auth = new OAuth2Authenticator
  (
      clientId: Keys.LinkedInClientId,
      clientSecret: Keys.LinkedInClientSecret,
      scope: &quot;r_liteprofile r_emailaddress&quot;,
      authorizeUrl: new Uri(&quot;https://www.linkedin.com/oauth/v2/authorization&quot;),
      redirectUrl: new Uri(&quot;https://www.linkedin.com/company/coeqwety&quot;),
      accessTokenUrl: new Uri(&quot;https://www.linkedin.com/oauth/v2/accessToken&quot;))
      {
          AllowCancel = true,
          ShowErrors = false,
          ClearCookiesBeforeLogin = true
      };
  
  auth.Error += (sender, eventArgs) =&gt;
  {
      rc.DismissModalViewController(true);
  };
  
  auth.Completed += (sender, eventArgs) =&gt;
  {
      var token = eventArgs.IsAuthenticated;
      if (eventArgs.IsAuthenticated)
      {
          var userName = eventArgs.Account.Username;
      }
      else
      {
          // The user cancelled
      }
      rc.DismissModalViewController(true);
  };
  
  rc.PresentViewController(auth.GetUI(), true, null);
  </code></pre>
  <p>Now when the rc.PresentViewController() gets called application get crash in real device while
  same thing is working fine in simulator.</p>
  <p>I have check the ApplicationOutput Window for details and in that I'm getting few lines which I think might be causing this issue, here it is:</p>
  <blockquote>
  <p>MyApp.iOS[9779:190200] WF: _WebFilterIsActive returning: NO</p>
  <p>MyApp.iOS[9779:190200] CoreAnimation: [EAGLContext
  renderbufferStorage:fromDrawable:] was called from a non-main thread
  in an implicit transaction! Note that this may be unsafe without an
  explicit CATransaction or a call to [CATransaction flush].</p>
  <p>MyApp.iOS[9779:190200] CoreAnimation: [EAGLContext
  renderbufferStorage:fromDrawable:] was called from a non-main thread
  in an implicit transaction! Note that this may be unsafe without an
  explicit CATransaction or a call to [CATransaction flush].</p>
  <p>MyApp.iOS[9779:190200] WF: _WebFilterIsActive returning: NO</p>
  </blockquote>
  <p>After this I have done R&amp;D using this messages and then I have Wrapped my code inside various method like:</p>
  <ul>
  <li>InvokeOnMainThread()</li>
  <li>Device.BeginInvokeOnMainThread()</li>
  <li>DispatchQueue.MainQueue.DispatchAsync()</li>
  </ul>
  <p>For Example:</p>
  <pre><code>DispatchQueue.MainQueue.DispatchAsync(() =&gt;
  {
      Device.BeginInvokeOnMainThread(() =&gt;
      {
          rc.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;
          rc.PresentViewController(auth.GetUI(), true, null);
      });
  });
  </code></pre>
  <p>But none of this things worked and app is still crashing, any help in this regard is highly appreciated.</p>
  <blockquote>
  <p><strong>Updates: getting this exception as I have added --optimize=force-rejected-types-removal in additional mtouch argument with linker behavior
  Link from sdk only</strong></p>
  </blockquote>
  <pre><code>{System.TypeInitializationException: The type initializer for 'IOS' threw an exception. ---&gt; System.NotSupportedException: Linked Away
    at UIKit.DeprecatedWebView..ctor (CoreGraphics.CGRect ) [0x00000] in 
  /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.3.2/src/Xamarin.iOS/UIWebView.g.cs:99 
    at Xamarin.Auth.WebViewConfiguration+IOS.UserAgentFromUIWebView () [0x00000] in &lt;85539ee049364f3e8d64880a4a42b589&gt;:0 
    at Xamarin.Auth.WebViewConfiguration+IOS..cctor () [0x00041] in &lt;85539ee049364f3e8d64880a4a42b589&gt;:0 
     --- End of inner exception stack trace ---
    at Xamarin.Auth.WebAuthenticatorController..ctor (Xamarin.Auth.WebAuthenticator authenticator) [0x00000] in &lt;85539ee049364f3e8d64880a4a42b589&gt;:0 
    at Xamarin.Auth.WebAuthenticator.GetPlatformUIEmbeddedBrowser () [0x00002] in &lt;85539ee049364f3e8d64880a4a42b589&gt;:0 
    at Xamarin.Auth.WebAuthenticator.GetPlatformUI () [0x000c3] in &lt;85539ee049364f3e8d64880a4a42b589&gt;:0 
    at Xamarin.Auth.Authenticator.GetUI () [0x00000] in &lt;85539ee049364f3e8d64880a4a42b589&gt;:0 
    at MyApp.iOS.RendererClasses.AuthenticationButtonRenderer.LinkedIn_call   }
  </code></pre>
  <blockquote>
  <p>Line where exception occur: rc.PresentViewController(auth.GetUI(),
  true, null);</p>
  </blockquote>
  <p>This is the page (Left image) I have discussed above, when In icon clicked it open this web page (right side image)</p>
  <p><a href="https://i.stack.imgur.com/SptNs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SptNs.png" alt=" " /></a></p>