Jump to content
LaunchBox Community Forums

Question about native dependencies in the plugin directory


Recommended Posts

Hi all,

I was playing around with an idea for a plugin and started prototyping to see what it would take and also learn the interfaces and API.  I added a reference to LibGit2Sharp, so that I could do a git clone from repositories of artwork, configurations, etc.  LibGit2Sharp is a .NET wrapper for pure C native libraries.

I placed all referenced/dependent libraries in the plugins folder from the build.

When I fire up LaunchBox it seems to want to load this native library and throws this error.  From logs...

2018-09-29 09:04:17 PM FIRST CHANCE EXCEPTION: System.BadImageFormatException: Could not load file or assembly 'git2-1196807.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'git2-1196807.dll' ---> System.BadImageFormatException: Could not load file or assembly 'git2-1196807.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'git2-1196807.dll'

LaunchBox will hang on loading interface and I have to end process on it.

image.thumb.png.3eff4c21a09d02cddbf3d56c9b81b091.pngNow... if I change the extension of the above file to bak and restart LB, everything loads up and I can see my plugin in the system menu.  While LB is running, I rename the file back to the original extension - dll.  The plugin will do its git operations as expected.

I suppose it's looking for the implemented interfaces in all dlls in that folder recursively, but should it crash trying to load a dependent native library?  I would think at a minimum, it should catch this exception and move on.  Has someone come across this before?  Or am I just doing crazy stuff?   ?

I do have a work around. Instead of using a git client, I can use a webclient and download the master zip of the repository, but I thought I would post this for visibility and possible solution.

 

Edited by Ateb
Removed spaces...
Link to comment
Share on other sites

Sounds like a fun little project you are working on there, I have used a handful of external libraries with LaunchBox before, and not had any issues like that but I have not attempted to use any C wrapper libraries. It looks like LaunchBox is trying to load the native code as a .Net library. There are probably multiple ways of working around this, the most obvious is dropping the DLL extension (I think that'd work, though may need some modification). It may also be possible to get LaunchBox to ignore the exception.

There is also another option for doing this that you may not have considered, which is simply utilising a version control client and calling it silently from the command line. I use SVN to pull individual folders from a repository hosted on GitHub with my PCSX2 Configurator plugin.

You may also want to consider using a pure .Net solution like GitSharp.

Though if you always want the latest version and all the files, you may just be best downloading and extracting master as stated above.

Edited by alec100_94
Link to comment
Share on other sites

Thanks for the reply and suggestions,

I looked into GitSharp, but looked elsewhere after seeing this post on their website.  It hasn't been updated in 8 years.

GitSharp development is currently on hold because we believe that the libgit2 project and its C# bindings libgit2sharp are far more promising to work on.

I'll probably abandon the git functionality, unless changes are made to LaunchBox to allow native libraries to co-exist in the plugins folder,  I believe the zip uses less bandwidth anyway.  ?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...