DLLNotFoundException under Unity whilst using FUBI - c#

I'm currently working on my Bachelor-Thesis, which revolves around extending the functions of a Kinectv2 in an Unity-environment.
However, I have little-to-no experience with Unity and C# and whilst setting up the FUBI library (which will be a core of my Thesis), I ran into this problem right away:
Upon starting the Unity project (provided by FUBI), I get a
DLLNotFoundException: FUBI.64.dll
followed by a plethora of errors from failing calls on said library.
The confusing part, to me: Back in university we decided to use FUBI, because we managed to install it, outofthebox, with zero issues within a few minutes. But now, at my home tower (Windows 10 and Unity 5.3.5, just like the machine at the university), this error persists.
The Unity project and all required DLL's are provided in a single download from the FUBI-website itself, which implies that the error shouldn't lay in the project, the provided DLL's or any weird dependancys.
The only thing one has to do (according to FUBI's readme) besides unpacking the zip containing the project is:
IMPORTANT: After installing the Kinect SDK, please execute the "CopyFaceTrackRedist.bat" located in the FubiUnity base folder or manually copy the "Kinect20.Face.dll" and "NuiDatabase" from the Kinect Developer Toolkit to that folder.
Which I've done via the bat, executed flawlessy and had both mentioned files/folders copied into the project directory.
Whilst trying to fix this, I started manually moving the Fubi64.dll to various locations within the Unity project, but the only result was Unity mentioning it found multiple instances of said dll, would only use one, and then throw the exception nontheless.
I've started to think it may be a dependency thing, but downloading and using the dependencywalker gave me little to no useable results.
(I mean, it's showing some errors, but afaik those are related to DW not being updated and unable to work with some forward-dependency-shenanigans or something, according to some other thread on stackflow I've read.)
Any help, or even pointers at what to try next, would be appreciated.

Spending days chasing after the issue, I finally found one entry in dependencywalker that made sense and after manually installing MPFLAT.dll into windows\system32, Unity was able to load the dll just fine. I would assume it's some dll related to mediaviewer or associated tools, since those don't come natively with Win10, I didn't specifically install any yet and it is well possible the other mentioned tower had something installed that brought the DLL along.

Related

Reference seemingly not working, no apparent error thrown

I have superficial knowledge on referencing libraries in projects. Usually most of the time a simple 'add reference' and then browsing to the appropriate path, just works. I am following an issue I will try to explain , and show all the approaches I tried to tackle it.
I am trying to use AutoIt. In their website it is stated that simply adding the .dll and using it, is enough to integrate their functionality in visual studio.
I am doing just that but for the moment I can not get my head around what is happening.
AutoItX is a public static class, as also the Run function is the same (public static). After adding the reference I can navigate to the appropriate .cs (if I control click on it for example). So the class AutoItX is not something unknown for the project. Moreover, the function Run indeed exists
however not inside the project itself. AutoItX also needs staff from (dont know if it is important):
The main error is that AutoItX doesnt exist in this context.
I have tried to register the dll, I have tried to add the com reference and remove it, I have tried to move the .cs files inside the project. None of those corrected the issue.
Any help would be valuable. If I missed something and you need extra info, I am willing to provide it. (Latest vs, latest autoit version, .net framework type of project).
Actually the above works.
For future reference.
The reason I did not try it first was, that they propose in their website to reference the autoItX.assembly.dll. This is probably deprecated and does NOT work anymore.
Second, if you have already referenced it , downloading this from NuGet WONT fix it.
Finally, the NuGet package does NOT work with .net CORE but ONLY with .net Framework project
I installed AutoItX.Dotnet 3.3.14.5, my test is no problem.
You can refer to my steps to create a new project to test it.
Right click References=>Manage NuGet Packages=>Browse=>AutoItX.Dotnet=>Install
Running result:

Problems trying to use Monodevelop on Manjaro

I can't get monodevelop to work on Manjaro. I tried all the different options to install in AUR (monodevelop-beta, monodevelop-bin, monodevelop-git, monodevelop-nuget3, monodevelop-stable) and most of them failed to build.
The only one that didn't fail was monodevlop-bin, but I couldn't get it to build my program. At first I got this error:
The imported project "/usr/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets" was not found.
Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. (MSB4019)
There was no folder "Roslyn" in the specified location. I made a folder with that name and copied the file Microsoft.CSharp.targets from msbuild/15.0/bin/ in the "Roslyn" folder (renamed the copy to Microsoft.CSharp.Core.targets).
It probably wasn't a good idea, but I tried it, just in case.
That did seemed to work, but then I got another error:
Parameter "AssemblyFiles" has invalid value "/usr/lib/mono/4.7-api/mscordlib.dll".
Could not load file or assebly 'System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a or' or one of its dependencies. (MSB3248)
doctorzeus commented on 2019-12-14 14:34
Since the issues with compatibility with the latest version of mono and msbuild as well as
there no longer being a "stable" build mode on the github project I am disowning this project.
Sadly I stopped using this IDE in favor of VSCode a while ago and also no longer have the time to maintain it with the large number of incompatibilities with the various dependencies.
Hopefully someone with more time will take over..
This is from the original maintainter/builder (at the time of writing) in the comments of the AUR page. After him, it seems that another person tried to continue maintaining it, but he still failed:
coder2000 commented on 2020-03-31 18:51
The build process is currently broken and the documentation is incomplete.
So, for now, you can't use monodevelop on Arch based systems (at least from AUR). You will have to use alternative IDEs, like JetBrains Rider, or text editors (with proper extensions), like VSCode or Atom.
Also, from personal experience, I would advice against using Arch based distributions for programming, because of problems like that. Use Ubuntu or something Ubuntu based for easiest experience with programming tools (I use Linux Mint for programming and I haven't had any major problems).

.NET custom dependencies (no nuget)

So, I'm having trouble adding a git project to my net Core solution, and after spending hours trying to figure this out and being uncapable of finding a solution online, I decided to ask here.
I have a forked github repo (link) in which I modified some files to suit my needs, but I simply can't seem to get it to work with my current project.
The problem I'm having is that normally, when I want a package for a .NET project, I usually simply go to nuget and fetch the necessary dependencies. This is usually very simple and straight forward. But now that I have these modified files, I'm unsure on how to proceed.
I have tried adding it as a submodule, but after I built the project, I got an exception saying that the dll could not be found.
Then I've tried adding the dll itself as a reference, but the ImGui.dll depends on a C dll which couldn't be found then (nor added to the project).
Finally, I've tried adding the csproj as a project of my solution, but that didn't work either
Do you know what am I doing wrong here? Am I missing a key piece or is it just something obvious I'm not seeing? It can't be this hard to get it to work
From the look of it, that repository produces a DLL (output type Class Library). So modify it to your liking, and use the sample program build (ImGui.NET.SampleProgram) to test your changes. Once you're happy, build the DLL project (ImGui.NET) and use the resulting DLL as a Reference in your own app.
In Visual Studio:
Solution Explorer>YourApp>References>Right Click>Add Reference...>Locate your DLL
This means you should also keep track of your modifications to the ImGui.NET project itself, since you may/will be required to maintain this in the future.
Hope this gets you started -- update your question with more specific issues once you're underway.
Edit:
Like #CoolBots mentions, I probably misread your question. Seems like the build depends on cimgui.dll, which you can hotlink from the ImGui repo along with your custom DLL. In fact, the demo app is using cimgui.dll, cimgui.dylib and cimgui.so. Regardless of linking method, you want the files to copy into your build folder. I don't believe subfolder /bin is necessary.
You can find all the cimgui dependencies for various operating systems in the ~/ImGui.NET/deps/cimgui folder.
The demo also utilizes NuGet packages Velrid and Velrid.StartupUtilities.
Depending on your own codebase, you may or may not require these NuGet packages along with the aforementioned class library.

Trying to connect a ergometer to pc using a SDK but program can't find dll

I'm trying to connect the concept2 ergometer with a PM4 with a computer so I can use it's input in a game made in Unity3D.
The company of the ergometer provides a SDK that's in C++ (I don't have experience with C++).
I'm using this code to wrap the C++ code in C#.
Here I replace "RPPM3DDI.dll" with "PM3DDICP.dll" and "RPPM3Csafe.dll" with "PM3Csafe.dll".
When I run the code the program throws the following exception:
System.DllNotFoundExeption for DLL PM3DDICP.dll
I put the files of the SDK in the solution folder so that's not it I guess...
So I read (on stackoverflow) that there can be problems with the dependencies and I used DependencyWalker. I got a ton of messages of missing dependencies but it turns out that DependencyWalker is not being maintained and some changes in Windows are causing the missing dependency reports...
The goal is to get the speed that a person is rowing with and use it in Unity3d.
The questions now are:
How can I use this SDK when he can't find the dll file?
How can I locate the dependency issues among all the 'fake' missing dependencies?
I found the problem and I thought: maybe this answer is usefull for someone else too.
The problem was that I put the SDK files in the wrong folder (noob mistake I know...).
I needed to put the files in: Project folder -> bin -> Debug
I couldn't find this solution on the internet

Use .dll to store other .dlls or .libs

I am using Visual Studio 2010 and I'm trying to create a .dll. My .dll uses an external library .lib. This Library also contains a collection of other libraries (.lib).
So: My main.lib is a container for the collection of libs - and as a result it is about 300mb big.
Now when I use the lib in my dll, its linking fine and it works correctly on my pc. But when I deploy my compiled program to another computer, then it couldn't load the .lib. It simply can't find it, even when I've put it into the directory of the .dll.
Now my question: Is there a way I can store all functionality of my .lib in a .dll? So that the .dll file will be about 300mb big but I don't need to deploy the .lib anymore?
Update:
Thank you all very much for your answers. To descripe my problem I want to show you this output of my program:
Unhandled Exception: System.Runtime.InteropServices.SEHException: External componennt has thrown an exception.
I've spent many hours of using google to solve this error. I've found out that it's a problem with a missing file (one of my "external components" (.dll)) couldn't find definitions of classes and so on or otherwise a problem with access rights.
I tried my best to fix this and with one try I had success and could use this program. I know that this is because I have put the main.lib into the right folder, so my program could find it. But now I don't know where to put this main.lib. So: my program is broken again and now I want to fix it... I hope this description helps. It's hard to describe it because I don't know exactly what the problem is...
Update 2:
Thanks to your help I solved my problem. At first I misunderstood the principle of how .dll's and .lib's are working. If anyone else has this problem and will be redirected to this post then #D Stanley's answer will help.
Thanks to #David Heffernan I've found out that it's not any missing .lib or something else which is causing this error. It's a problem in my native C++ Code (which is in the .lib). So I fixed this problem (which caused an exception) and now everything is working fine.
Thank you all for your help.
You can not statically link static libraries in other static libraries. What you should be doing instead is statically linking all those individual static libraries in your DLL. Does the linker not warn you about this?
Also, you can't deploy static libraries to another machine, as they can't be linked at run time.
If I understand your situation:
You have several static libraries (.lib)
They are linked together into one big static library (main.lib)
You want to use this library in your dynamic library (.dll)
I'm not certain what's happening locally, but lib files are not "loaded" at run-time - they are linked into either a dynamic library that is loaded at run time (hence the name "dynamic" or into the executable itself. So if your application is working now, then either you're already linking part of it into your dll or it's getting linked into the executable.
So to answer your question, yes, you can link your lib file into your dll - and it will include all of the necessary object code into it. Note that it may not be as big as the source library - that depends on how much of the original code is used by your library.
I also don't see how c# is part of your situation.
From your description it seems that you are linking with *.lib stubs that accompany DLLs for their static loading. You have those DLLs on your computer but not on other computers where you try to use your DLL. So to make everything work, find and copy those DLLs together with your DLL.

Categories

Resources