microsoft/kiota-dotnet

Unable to load assembly depending on Kiota or kiota dll.

Opened this issue · 8 comments

My application leverages a plugin architecture where in which dll's can be dynamically added to the application for different integrations. These plugins are loaded using "Assembly.LoadFile" however when it attempts to load Microsoft.Kiota.* (excluding the abstractions) package it will fail to load as can't get the types. It will also cause any library dependent on Microsoft Kiota to also fail resulting in my plugin not being loadable.

The exception i am encountering is:
Message:

{"Unable to load one or more of the requested types.\r\nCould not load file or assembly 'Microsoft.Kiota.Http.HttpClientLibrary, Version=1.16.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified."}

StackTrace

   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at Skidata.Dashboard.Connector.ConnectorResolver.LoadConnector[T1](List`1 options, String folder) in C:\Users\thja\Documents\Repos\dashboard\interface\panel-connector\src\Skidata.Dashboard.Connector\ConnectorResolver.cs:line 27

Loader Exceptions

{"Could not load file or assembly 'Microsoft.Kiota.Http.HttpClientLibrary, Version=1.16.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.":"Microsoft.Kiota.Http.HttpClientLibrary, Version=1.16.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}

Application is being compiled for dotnet 8
libary: 1.16.1

Hi @thompson-tomo
Thank you for using kiota and for reaching out.

I'd like to mention that we're operating with a reduced team at the moment, expect delays in responses, thank you for your patience!

Can you ensure the dll is present with the deployment and in the expected location for your assembly loading implementation to find it please?

Do you have other modules that depend on additional dependencies and are loading fine? Can you compare the references of the package (and the copy mechanisms)

No worries especially as I am also on leave atm.

Yes I can confirm file is present in the folder and In fact to achieve the plugin architecture I am scanning the configured folder for all dll's which is how I determine what could be loaded. With the folder being a clone of publish output.

What I found is that the abstraction lib will load without issue but not the others. At the same time Std.UriTemplate has no issue loading. One of my other plugin is operating without issue with a dependency on Brainboxes.IO.

Thank you for the additional information.

Is http client the only one that doesn't load? or do you also have issues with serialization JSON/Text/Form/Multipart?

Also issues with serilaztion. I have a dependency on the bundle & only abstractions will load everything else fails.

baywet commented

Thank you for the additional information.

Does the issue happens only in production? or also when you try to debug the application in the IDE? (the linkage is a bit different between the two)

Issue Also occurs when running my app in the visual studio debugger. Note I have tried to load both the published output & also the bin output but same result.

baywet commented

Thank you for the additional information.

Is your app using any trimming? are the hashes of the dlls in the source package and the published result the same? (trying to check whether anything might have been tempered by a custom build process here)

Are you able to share a minimal reproduction repository?

Thanks!

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.