Skip to content

Errors with DllExport 1.8.1 , .Net 8.0 and Delphi: Could not load type ... from assembly ... #250

@plamenjm

Description

@plamenjm

DllExport version

1.8.1

Environment

Visual Studio IDE

Ask the .NET DllExport project

DLL native export works with DllExport 1.7.4 - Delphi code calls .Net v4.8 function.

I updated the project and it does not work anymore - .Net 8.0, DllExport to 1.8.1.
Please, find attached a demo project.

DllExport options in this demo are from here:
https://github.com/3F/DllExport/blob/master/src/DllExport/assets/NetCoreAsset/NetCoreAsset.csproj

  1. It works when the exported function is empty, without parameters, without result.

  2. The attached demo calls System.Diagnostics.Process.Start. Similar with the real project.

2.1. Most of the time I get exception:
EExternalException: External exception E0434352

There is try/catch, but it does not help. I suspect an assembly is not found, but I do not see any details.
This is the error I get with attached demo project.

2.2. Rarely, there is another error:
Could not load type 'System.Diagnostics.Process' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

I wanted to prepare a demo for this second error, but I could not.

In this case, I tried to add System.Diagnostics.Process to DllExportRefPackages list. It did not help.

Please note the "README-files-list" - dependent assembly DLLs are found Only in the Publish folder. I suspect, that is after ILRepack step.

During the tests I used SelfContained publish:
Properties\PublishProfiles\FolderProfile.pubxml: <SelfContained>true</SelfContained>

Thank you.

ClassLibrary1.zip

DllExport configuration

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions