Monday, July 27, 2009

Delphi 2007: Internal Error URW5517

I encounter the following error while trying to compile my application in Delphi 2007 (11.0.2902.10471):

F2084 Internal Error: URW5517

After a thorough testing, I found out it should be a Delphi compiler error in the version of Delphi 2007.

To replay the problem, create a new console project in Delphi 2007 and add the following unit into project:

unit Test_URW5517;

interface

implementation

procedure Test(const aObject: TObject);
var E: procedure(const aObject: TObject = nil);
begin

end;

end.

Then compile the project by pressing Ctrl-F9 for few times and you will encounter the error eventually.  If you build the project (Shift-F9) instead of compile, no error will be prompted.

In above unit, the Test procedure has a procedural variable E with the following declaration:

var E: procedure(const aObject: TObject = nil);

The procedure has a default parameter aObject.  This is the cause of the URW5517 internal error.

To avoid the internal error, try not to use default parameter in procedural variable declaration:

var E: procedure(const aObject: TObject);

This problem should have reported in Quality Central (QC#58068: Internal error in procedural type declaration with default parameter).  However, the resolution was “can’t reproduce” or it resolve in Delphi 2009.  There is no patch for Delphi 2007 to resolve this problem.

Thursday, July 23, 2009

Using Delphi 2007/2009 IDE in Windows x64

I use Windows 7 x64 for daily Delphi development task.  If I press F9 to run my application in IDE mode, there is a great chance to hit this error:

‘Assertion failure: “(!”SetThreadContext failed”)” in '..\win32src\thread32.cpp at line 412
Continue execution?

Capture

If Press No or ESC key will close the whole IDE.  Pressing Yes may prompt for the same dialog more.

There is a temporary solution for this problem.  Please note that this problem might gone in Windows 7 RTM release.

Delphi 2007

  1. Using any hex editor to open %ProgramFiles(x86)%\CodeGear\RAD Studio\5.0\bin\bordbk105N.dll
  2. The file version should be 105.11.1.12533
  3. Look for hex string in the file
    01 00 48 74 47 80 3d change to 
    01 00 48 EB 47 80 3d

Delphi 2009

  1. Using any hex editor to open %ProgramFiles(x86)%\CodeGear\RAD Studio\6.0\bin\bordbk120N.dll
  2. The file version should be 120.903.17.15115
  3. Look for hex string in the file
    01 00 48 74 47 80 3d
    change to 
    01 00 48 EB 47 80 3d

Reference:

  1. Temporary Solution: Delphi 2009 and Windows 7