✅ Could not load file or assembly or one of its dependencies at runtime despite being present
I'm developing a Visual Studio Extension in .net Framework. I'm getting this attached ulcer-inducing error at runtime.
I've downloaded the most recent version of Syncfusion.Edit.WPF via NuGet and this also downloads its dependencies (listed here). It's clearly in the Project references (attached) and also in the build directory (attached). The dlls are also the right file version (matching those in nuget).
Lastly, I used this in another Extension project with exactly the same libraries/references and it works fine. So I think it's something to do with my Solution/Project or a .net idiosyncrasy.
The xaml:
(no intellisense errors)
I've tried all the normal: deleting obj/bin folder, cleaning the solution, restarting VS. It persists. Any ideas?
Github Repo: https://github.com/stigzler/VisGist
GitHub
GitHub - stigzler/VisGist
Contribute to stigzler/VisGist development by creating an account on GitHub.
49 Replies
It's working ¯\_(ツ)_/¯
you've just built that on your pc?
Yep
Yep - it builds, but you get the error at runtime
Ah, I see, it happens when you try to open the window
Have you tried adding them into the
AssemblyInfo.cs
?Well - thanks for taking the time to check, but not sure how that moves me on really
yeah - I'm not sure Extensions have that - couldn't see it in the folder
I did check the csproj file - all references to the right versions
wait
SHould this also be refencing Syncfusion.GridCommon.WPF etc?
Ah no - just checked the other working extension which uses the control and they're not there
God this is frustrating
Nah, it's working, you just need to give VS a hint about the packages
Not only the top-level, but also the transitive packages as well
how do i do that?
I'm on it, sec
Ok - thanks
Btw. you have binding errors
the "hello world" one?
Not only
Add this to your
AssemblyInfo.cs
that's weird - is that in the "XAML Binding Failures" window? If so - I only get this:
Okay, it opens and it threw an exception about the token cannot be null, but that's it.
Thanks - but I haven't got an assemblyinfo.cs - should it go in
VisGistPackage.cs
?You do
It's autogenerated
what am i missing?
Easiest way to bring it up is to search the project for
[assembly
.
CTRL
+SHIFT
+F
, look in Entire Project
or Entire solution
and search after [assembly
.oh bloody hell - sorry - isn't it nomally in the project root?
Depends on the project template, in newer ones it is, but this is the older .net framework template
one moment - got same error, but doing bin/obj delete and vs restart
It should look like this:
Yep + no dice - same error, interstingly in a different place:
Add this assembly to the list
Just add
[assembly: ProvideCodeBase(AssemblyName = "Syncfusion.Tools.Wpf")]
oh yeah - didn't spot it missing
Those are transitive packages of the top-level Syncfusion packages
I missed that one
off by 1 error! 🤣#
one mo - more probs
I guess this it how it should look like
OK - progress, but now I'm getting an error in my code where it executed successfully before on an library referenced in those additions
Does the order in AssemblyInfo.cs matter?
Afaik, no
But I don't get any errors at all, it's working, thou it does show white text on white background and the gists content doesn't load, but since it's not a finished product I would say it's fine.
Creation is somehow working
Yeah - that implies that the SkinManager isn't working. Maybe the theme assemblies weren't being loaded before, but now they are - it's throwing an error. Weird thing is - I used exactly the same libraries and code in another extension and didn't have to do any of this...
Shouldn't nuget auto-update projects with the right libs etc?
What do you mean by auto-update? Getting the latest version automatically? No. Retrieve dependencies and setting them as transitive packages? Yes.
Yeah - soz - ambiguous. I meant update AssemblyINfo.cs or any other relvant files.
Anyways - not to worry - success -
I just removed the theme libraries from assemblyinfo.cs and it now owrks
*works
It does it, but VSIX projects are a bit different to regular projects, it's missing something. Also I'm not very familiar with VSIX dev at all - maybe there are newer project templates for VSIX dev as well
YEah - would make sense. Anyways a huge thank you! I'd never have found that in a million years and any searches cam nowhere near that
Right - back to coding I enjoy... (not crap like that!!)