Skip to content

Allow customizing NativeLibrary path in .NET Framework #25211

@tiagonapoli

Description

@tiagonapoli

Is your feature request related to a problem? Please describe.

I'm working on a big legacy project which has a strong dependency to a particular nuget project that internally has another dependency that tries to load all .dll files inside /bin. When it tries to load grpc_csharp_ext.x86.dll or grpc_csharp_ext.x64.dll it throws System.BadImageFormatException (when trying to get the assemby name via AssemblyName.GetAssemblyName). The problem is this dependency is very old and its source code is nowhere to be found so the only solutions I'm seeing would be to migrate this big dependency out of the legacy codebase, which would be pretty hard, or move grpc_csharp_ext.x64.dll and grpc_csharp_ext.x86.dll out of /bin and customize the loading path.

Describe the solution you'd like

There's already a TODO in the code, so I was hopeful that this could become a feature - I know that the problem I'm facing is not a grpc issue per se, I'm opening this issue just because this TODO would solve my problem

// TODO: allow customizing path to native extension (possibly through exposing a GrpcEnvironment property).
// See https://github.com/grpc/grpc/pull/7303 for one option.
var assemblyDirectory = GetAssemblyDirectory();

For my use case allowing customizing the NativeLibrary directory on .NET Framework via environment variable would suffice

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions