title: why am i getting FatalExecutionEngineError
body: <p>i'm running this code</p>
  
  <pre><code>var existing =( from r in DB.Database.Entities.OfType&lt;DBWorkReport&gt;()
                where Math.Round(r.Location.Latitude ?? 0, 6) == Math.Round(latitude, 6)
                &amp;&amp; Math.Round(r.Location.Longitude ?? 0, 6) == Math.Round(longitude, 6)
                &amp;&amp; r.WorkType.Description == type
                select r).FirstOrDefault();
  </code></pre>
  
  <p>the error also occurs on a simple 
  DB.Database.Entities.ToList();</p>
  
  <p>where </p>
  
  <p>DB is </p>
  
  <pre><code>public class DatabaseInterface : INotifyPropertyChanged
  {
  
      public void Initialise()
      {
          if (Database == null)
          {
              Database = new DataDBEntities();
          }
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      private DataDBEntities _Database;
      public static readonly PropertyChangedEventArgs DatabaseProperty = new PropertyChangedEventArgs(nameof(Database));
  
  
      public DataDBEntities Database
      {
          get { return _Database; }
          set
          {
              _Database = value;
              PropertyChanged?.Invoke(this, DatabaseProperty);
          }
      }
  </code></pre>
  
  <p>Entities is</p>
  
  <pre><code>public virtual DbSet&lt;DBEntity&gt; Entities { get; set; }
  </code></pre>
  
  <p>DBWorkReport is </p>
  
  <pre><code>public partial class DBWorkReport : DBEntity
  </code></pre>
  
  <p>and r.Location is DBGeography</p>
  
  <p>however when i run it, its throwing </p>
  
  <blockquote>
    <p>FatalExecutionEngineError occurred   HResult=-2146233082<br>
    Message=Exception of type 'System.ExecutionEngineException' was
    thrown.   InnerException:</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/us3Ag.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/us3Ag.png" alt="enter image description here"></a></p>
  
  <p>to quote MSDN:</p>
  
  <blockquote>
    <p>FatalExecutionEngineError: 
    This type previously indicated an unspecified fatal error in the
    runtime. The runtime no longer raises this exception so this type is
    obsolete.</p>
  </blockquote>
  
  <p>at a another point i'm successfully calling this code so it doesn't seem that the problem is the connection to SQLServer</p>
  
  <pre><code>lookups = DB.Database?.Lookups.Where(l=&gt;l.companyid==DB.CompanyID).ToLookup(g =&gt; g.LookupTypeId) ;
  </code></pre>
  
  <p>so what's not working?</p>
  
  <p>Update:</p>
  
  <p>from DB</p>
  
  <pre><code>SELECT *,
        [Location].ToString() as WKT
    FROM [WorkReport]
  
  Id  TypeID  ProximityId lineID  Location    WKT
  178 6   2   7   0xE6100000010C8743DC9D754E4A40EB4B08A5400102C0  POINT (-2.25061158114976 52.6129643750674)
  179 4   2   7   0xE6100000010CC4A6BF62F7504A40F9ACC89EB70602C0  POINT (-2.25327991533197 52.6325496135519)
  180 7   2   7   0xE6100000010CAFC1F420EF624A40D795D41A58F301C0  POINT (-2.24382039033183 52.7729226298428)
  181 7   3   7   0xE6100000010C988B36673E654A40E049A63A0BEA01C0  POINT (-2.23927923030827 52.7909668938002)
  182 6   2   7   0xE6100000010CF3D11F539F8B4A4028430DF623DE02C0  POINT (-2.35846702793096 53.0907997041103)
  183 8   2   8   0xE6100000010C82B9B41004534A40F97B9728ECDEF8BF  POINT (-1.55442443710467 52.6485615618176)
  184 4   2   6   0xE6100000010C8A8A301567434A409AFAF6A6232BFEBF  POINT (-1.88553204746828 52.5265833365457)
  185 9   2   4   0xE6100000010CBB7D019FD8404A40BD903C1DCA5902C0  POINT (-2.29384253350335 52.5066107518464)
  186 8   2   4   0xE6100000010CF2EDF4D773134A406773A2484D9907C0  POINT (-2.94985443826447 52.1519727655358)
  187 6   1   4   0xE6100000010C381064A1F6F849408310A651BCD10CC0  POINT (-3.60240997112311 51.94502656351)
  188 2   3   4   0xE6100000010CD3FCB73E6AF3494087D7B17DB7950EC0  POINT (-3.82310388754826 51.9016798399331)
  189 2   1   4   0xE6100000010C44BB08BD5EED4940C320C2BF4A9610C0  POINT (-4.14676952001918 51.8544536869654)
  190 6   2   4   0xE6100000010C0124660902D8494019DDE9B866BC13C0  POINT (-4.93398560454741 51.6875621556028)
  191 1   2   4   0xE6100000010CF135C7CD4DDD494082104C75780714C0  POINT (-5.00729544903527 51.7289368841847)
  </code></pre>