title: Error Delphi XE2 - Exception class $C00000005
body: <p>I am getting this error will debugging a project, which used to be in Delphi 7 and I have been upgrading to Delphi XE2, the same error happens in several methods.</p>
  
  <pre><code>First chance exception at $006DC660. Exception class $C0000005 with message 'access violation at 0x006dc660 read of address 0xffffffff' 
  </code></pre>
  
  <p>This is one of the methods:</p>
  
  <pre><code>PFI = ^TFI;           
  TFI = record
  Id         : TToken;
  Name       : TName;
  Parameters : string;
  end;
  
  function TListFI.IsIn(S: PChar): PFI;
  
    function SearchName2(Item: PFI):Boolean;
    var N1, N2: PChar;
    begin
      N1:= StrNew(Item^.Name);
      N2:= StrNew(S); //Here is the issue
      SearchName2:= (StrComp(StrUpper(N1), StrUpper(N2)) = 0);
      StrDispose(N1);
      StrDispose(N2);
    end;
  
  begin
    IsIn:= PFI(FirstThat(@SearchName2));
  end;
  </code></pre>
  
  <p>I have googled and I found someone describing a similar problem, and he affirms that when the incremental linker is disabled it works, can someone tell me what and where is it or give some advice to solve this situation.</p>
  
  <p>[EDIT]</p>
  
  <p>Removing the @ now gives me the following error in IsIn:= PFI(FirstThat(SearchName2));</p>
  
  <pre><code>E2010 Incompatible types: 'TObject' and 'PFI'
  </code></pre>
  
  <p>I am adding the FirstThat procedure to see if it may help.</p>
  
  <pre><code>TFuncionColeccion = function (Elemento: TObject): Boolean;
  
  function TColeccion.FirstThat (Rutina: TFuncionColeccion): TObject;
  var
    i: Integer;
  begin
    For i:=0 to Count-1 do
      if Rutina(Items[i]) then
      begin
        FirstThat:=Items[i];
        exit;
      end;
    FirstThat:=nil;
  end;
  </code></pre>