✅ Ported an app to .NET 7, rebuild all my dependencies, app refuses to load them
READ THIS FIRST: I tried all the typical debugging methods such as assembly binding logs and whatnot, to little to no results. This isn't easily solved with google.
Hey everyone,
I was porting an app to .NET 7 (from .net framework 4.6), and I keep having an assembly not found exception from my dependencies. I tried ProcMon and tools that show me the assembly binding failures, but for some reason nothing shows there. I also tried Dependency Walker but it just freezes while loading them.
I'm not sure if the host that runs the app (since modern .NET uses an app host to actually run the app) is preventing this from going to logs and therefore it's being very hard to debug.
I also have other issues with VS2022, where it either randomly (not always) fails to build due to metadata file missing for my main dependency (even tho it's being built in one of the projects that errors with that, multiple attempts to build usually "fix" that), and also where the main dependency's project shows warnings about the types I create there being found in two places (which are the dependency in both cases).
I tried doing
dotnet publish
for the 3rd party dependencies, so not sure if that's related?
I'd really appreciate some help here as I never went beyond .NET Framework until now.
Thank you very much for your help!39 Replies
can you tell us exactly what the errors are?
I know this can happen from a missing dependency inside the dependency (glfwnet in this case depends on glfw but glfw is in the same folder)
how do you mean "in the same folder"?
are these not 2 projects in the same solution?
glfwnet in this case is a separate dependency I built, not in the same solution
however glfwnet is located in the same working directory folder for the project in the solution
So it's some random loose
.dll
?so the Player should be able to see it
yeah but for some reason I can't get an answer as to which DLL it is
it's also set as a dependency of the Player project, so it's copied around on build
what is this project setup lol
assembly binding logs don't show for this, and dependency walker freezes when analysing the DLL
it's a game engine, I got a dependencies solution for building 3rd parties, and a Engine solution for building the main engine projects
the engine solution has the Player, Core, Editor, and Editor App
both the Editor App and Player fail to run due to this error
Well, I won't be of much help. I never reference loose
.dll
s, I either use Nuget for dependencies, or just reference the project itselfit's likely a native dependency that's failing to load
this error can appear when an assembly's dependency fails to load
is this a runtime error?
yeah
then... i guess the
.dll
is just not set to copy to output...?the related DLLs should all be copied directly to this folder
problem is I can't figure out which DLL is missing because the tools I would use to figure this out aren't working
the assembly binding log is empty, and dependency walker freezes
it's really not clear at all what you're doing
okay
I built my project
all the dependencies are in the spot
when I try to open it, it fails to run due to a dependency not loading
I can't figure out why because the tools you would use for this don't work for giving details of the problem
What project. What are you building. What's the full setup. What dependency is missing. Where are you getting it. Why could it be failing.
So much info missing
^
I'm using VS 2022 and C#
some dependencies are native and are imported as native DLLs
I don't know what dependency is missing, because the tools I used so far don't tell me
however I just used asmspy to list my assembly references at least and solved some of the problem
now only one of the projects doesn't work
Newtonsoft.Json was for .NET 6 while I was using .NET 7, so I recompiled it to 7 and now at least the Player project works. the Editor project still doesn't work unfortunately.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Oh what the fuck. I thought that
glfwnet
project was the one they're making
See this is what happens if you don't explain properlyUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
you can't even have a "native" dependency in c# can you?
or would you consider a library that you P/Invoke a "dependency"?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Glfwnet depends on glfw to work, and at least at the time didn't have net7 version
Newtonsoft json also doesn't have a net7 version on nuget
why should it?
why would you use it, anyway?
newtonsoft has a net6.0 version, that's gonna work just fine with net7.0
Newtonsoft was failing to load for me
that's a you thing
it definitely works
but you don't even want to use newtonsoft in net7.0
it's absolute dogshit (and that's putting it lightly) compared to STJ on that version
Newtonsoft was failing to load because I had two assemblies using two different versions of another assembly (since newtonsoft was 6 and my other assembly 7)
doesn't make sense
I already tried using asmspy, ilspy, procmon, fusion, dependency walker, and I still can't figure out why my editor DLL won't load
I even tried removing most of its code and it still doesn't work
the only dependency it has is my Core project, which works since my Player project runs
do you wanna share literally any part of your project setup
any code
your project files
anything at all
GitHub
GitHub - LittleCodingFox/StapleEngine at feature/net7
Contribute to LittleCodingFox/StapleEngine development by creating an account on GitHub.
yeah this is a very... unusual? project setup...
you include dependencies using their built binaries, what are you doing
just use nuget packages
the nuget packages don't have net7 versions
it doesn't matter
it was failing to load, so it does matter
if they're compatible, they're compatible
it does not matter.
You're clearly messing something else up in your project setup for it to not work
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.I accidentally figured out the cause: Apparently, dotnet projects don't like having their bin/obj shared. By moving the projects to each source subfolder, all the problems seem to have been fixed!