Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Packages/Import Component    [ Add a report in this area ]  
Report #:  134651   Status: Open
Cannot import a .NET DLL
Project:  Delphi Build #:  XE, XE1
Version:    21.0 Submitted By:   John Michel
Report Type:  Basic functionality failure Date Reported:  11/3/2015 7:59:48 AM
Severity:    Critical / Show Stopper Last Updated: 12/10/2015 3:08:10 AM
Platform:    All platforms Internal Tracking #:   72709
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
I am reporting the same issue as reported in case  91230.

I see  91230  was closed without any comment as to why it was closed.

Is importing .NET DLLs supported? Please clarify. There are too many threads reporting the same issue but no apparent resolution.

If there is no resolution, please let us know so that we can move on.

Thanks,
John
Steps to Reproduce:
1. Run Delphi XE.
2. On Component menu, select Import Component...
3. In Import Component screen, select Import .NET Assembly.
4. Click <Add> button to locate the .NET Assembly dll.
5. Select assembly dll and open it.
  
You will get an error "'{}' is not a valid GUID value"

The same .NET assembly works fine in Delphi 2010 so this is obviously a regression issue.
Workarounds
None
Attachment
134651.zip
Comments

John Michel at 11/3/2015 6:46:31 PM -
I may have found a clue to this issue.

Based on case 91230, the stack trace is:

[5006673D]{rtl160.bpl  } System.SysUtils.ConvertErrorFmt (Line 4477, "System.SysUtils.pas" + 1) + $10
[50066775]{rtl160.bpl  } System.SysUtils.InvalidGUID (Line 4547, "System.SysUtils.pas" + 1) + $17
[50066820]{rtl160.bpl  } System.SysUtils.StringToGUID (Line 4572, "System.SysUtils.pas" + 1) + $24


The issue seems to be that Visual Studio generates GUIDs that look like this in a .NET assembly:

[Guid("7B2FA042-8632-4B0B-9914-596C31BEAB4E")]

Note that there are no curly braces around the GUID. You cannot actually add curly braces to this statement. The Visual Studio compiler will throw an error.

The issue seems to be that the Delphi Import .NET component feature is taking the GUID value literally and calling StringToGuid.

StringToGuid will fail if there are no curly braces.

This requires a fix in Delphi as I cannot think of a workaround.

Please advise.

John

John Michel at 11/7/2015 8:22:41 AM -
I have attached a very simply .NET class to demonstrate the issue.

Is there anyone out there? Will someone respond to this?

John Michel at 11/7/2015 2:47:48 PM -
One more piece information. This was tested with Delphi 10 Seattle, Version 23.0.20618.2753.

John Michel at 11/10/2015 11:12:18 AM -
Anyone there?

John Michel at 11/12/2015 6:39:19 PM -
I finally did get a reply via Sales. The recommendation was to forget about doing this from the IDE and use the command line tool which worked fine.

C:\DotnetTest\bin\Debug>tlibimp -P DotnetTest.dll
Embarcadero TLIBIMP Version 12.16581
Copyright(c) 1995-2010 Embarcadero Technologies, Inc.

Opening  DotnetTest.dll
Type library loaded ....
Created  C:\Users\amann\Downloads\ImportDotNetAssembly\DotnetTest\bin\Debug\mscorlib_TLB.dcr
Created  C:\Users\amann\Downloads\ImportDotNetAssembly\DotnetTest\bin\Debug\mscorlib_TLB.pas
Created  C:\Users\amann\Downloads\ImportDotNetAssembly\DotnetTest\bin\Debug\DotnetTest_TLB.dcr
Created  C:\Users\amann\Downloads\ImportDotNetAssembly\DotnetTest\bin\Debug\DotnetTest_TLB.pas

You can close this case as far as I'm concerned but you may want to log a bug against the IDE because this feature is broken in the IDE.

Server Response from: ETNACODE01