Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

Program linked to squirrel.dll fails to load dll

Open JohnThomson opened this issue 11 years ago • 28 comments

Something changed in the last 50 commits (our fork has been a bit behind) which breaks our application. Autofac tries to load the squirrel.dll (which we link to for startup events) and throws an exception indicating it can't find it. I know I'm not giving you enough information to solve the problem but I don't see how to short of our whole Squirrel fork and the application that uses it. Just wondered if anyone knows of anything that changed that might affect loading the DLL. (Our app is built as x86 while Squirrel is AnyCPU, but that wasn't a problem earlier.)

JohnThomson avatar May 21 '15 19:05 JohnThomson

Update to master, I just pushed a fix for what might be causing this

anaisbetts avatar May 21 '15 19:05 anaisbetts

I've been messing with #353 all day. I haven't been able to figure out what is missing but the SN fix seems to have bonked something. I just pulled master and it's still doing it.

I hate that error "Could not load fire or assembly OR one of it's dependencies". I've never been able to get a solid way to determine what is missing.

#353 makes more sense long term than mine (#352), just wasn't sure how else to get it working,

PushOrigin avatar May 21 '15 20:05 PushOrigin

You probably still have references to NuGet.Core and need to remove them

anaisbetts avatar May 21 '15 20:05 anaisbetts

I wondered if it might be Microsoft.Web.XmlTransform since it's a dependency of NuGet.Core?

I tried adding it to the ILRepack of Squirrel.dll but it didn't seem to make any difference. However I'm still wrapping my head around ILRepack so I'm not sure that I did it right.

PushOrigin avatar May 21 '15 20:05 PushOrigin

Will try latest rev and removing refs shortly. In the meantime, one more bit of information: here is a fuslogvw report. It seems the assembly loader is for some reason looking for squirrel.dll.dll instead of simply squirrel.dll.

*** Assembly Binder Log Entry (5/21/2015 @ 2:51:59 PM) ***

The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\PalasoGit\BloomDesktop\output\release\Bloom.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Squirrel.dll, Version=0.99.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///C:/PalasoGit/BloomDesktop/output/release/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = Bloom.exe

Calling assembly : Bloom, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context. LOG: Using application configuration file: C:\PalasoGit\BloomDesktop\output\release\Bloom.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/PalasoGit/BloomDesktop/output/release/Squirrel.dll.DLL. LOG: Attempting download of new URL file:///C:/PalasoGit/BloomDesktop/output/release/Squirrel.dll/Squirrel.dll.DLL. LOG: Attempting download of new URL file:///C:/PalasoGit/BloomDesktop/output/release/Squirrel.dll.EXE. LOG: Attempting download of new URL file:///C:/PalasoGit/BloomDesktop/output/release/Squirrel.dll/Squirrel.dll.EXE. LOG: All probing URLs attempted and failed.

JohnThomson avatar May 21 '15 20:05 JohnThomson

wat

anaisbetts avatar May 21 '15 20:05 anaisbetts

I wondered whether the addition of packing those two DLLs with squirrel was causing the problem so I tried backing that change out and still had the problem.

JohnThomson avatar May 21 '15 20:05 JohnThomson

I saw Squirrel.dll.DLL too but thought maybe that was just the loader trying the next thing.

Nuget.Core isn't referenced. Mine is a simple winforms proof of concept. The only packages and references is Squirrel.Windows and it's dependencies. No Nuget.Core in the references or in the directories.

PushOrigin avatar May 21 '15 20:05 PushOrigin

FWIW I'm building your nupkg and putting it in a local nuget repository so I just remove it when I want to swap out versions. The app works with #352 as hokey as that PR was. :)

PushOrigin avatar May 21 '15 20:05 PushOrigin

Here's a comparable log of a successful load (of earlier version). Note the success is not .dll.dll *** Assembly Binder Log Entry (5/21/2015 @ 3:05:13 PM) ***

The operation was successful. Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Users\Thomson\AppData\Local\BloomBeta\app-3.1.4\BloomBeta.exe --- A detailed error log follows.

Pre-bind state information LOG: DisplayName = Squirrel, Version=0.9.4.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///C:/Users/Thomson/AppData/Local/BloomBeta/app-3.1.4/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = BloomBeta.exe Calling assembly : Bloom, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Users\Thomson\AppData\Local\BloomBeta\app-3.1.4\BloomBeta.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Users/Thomson/AppData/Local/BloomBeta/app-3.1.4/Squirrel.DLL. LOG: Assembly download was successful. Attempting setup of file: C:\Users\Thomson\AppData\Local\BloomBeta\app-3.1.4\Squirrel.dll LOG: Entering run-from-source setup phase. LOG: Assembly Name is: Squirrel, Version=0.9.4.0, Culture=neutral, PublicKeyToken=null LOG: Binding succeeds. Returns assembly from C:\Users\Thomson\AppData\Local\BloomBeta\app-3.1.4\Squirrel.dll. LOG: Assembly is loaded in default load context.

JohnThomson avatar May 21 '15 20:05 JohnThomson

Tried merging in latest (b61c7e748bb7479d17cd7f08d5c7e701c1ebd01e) and removing ref to nuget (also mono.cecil). Did not fix it.

JohnThomson avatar May 21 '15 20:05 JohnThomson

Still have refs to Mono.Cecil.Mdb, Mono.Cecil.Pdb, and Mono.Cecil.Rocks which I think only came in because Squirrel needed them...I'll try taking those out too. Builds without them, but still won't load squirrel DLL.

JohnThomson avatar May 21 '15 20:05 JohnThomson

Just for grins I tried rebuilding Squirrel with NuGet.Core 2.8.3. Same error.

PushOrigin avatar May 21 '15 20:05 PushOrigin

Comparing the successful and failed load logs, it's noticeable that the displayName is Squirrel when it works, Squirrel.dll when it fails. Somewhere the loader seems to be getting an extra .dll which is messing things up.

JohnThomson avatar May 21 '15 20:05 JohnThomson

Yeah, I googled "Attempting download of new url" and the examples I found don't do that. Funny that nothing shows in the commits though. I wonder if ILRepack is doing something funny when it repacks a dll?

PushOrigin avatar May 21 '15 20:05 PushOrigin

I wondered about that too...could it convert somehow from AnyCpu to something that will only run with a true x64 program? But I already tried once backing out the ILRepack step altogether and the unmodified squirrel.dll still had the problem...assuming I didn't mess up the experiment somehow, of course.

JohnThomson avatar May 21 '15 20:05 JohnThomson

That's my problem. Even with a simple winforms app that does nothing but run Squirrel I'm always worried that I've somehow messed something else up and the error isn't actually in Squirrel.

PushOrigin avatar May 21 '15 20:05 PushOrigin

When I look at the reference to squirrel in my program, its Identity is squirrel.dll. For every other DLL I've looked at, the Identity does not include the extension.

JohnThomson avatar May 21 '15 20:05 JohnThomson

Further, looking in the manifest of my program, I see

.assembly extern Squirrel.dll { .ver 0:99:1:0 }

none of the other extern declarations has .dll as part of the name. Moreover, in the working version of my program, with the old squirrel.dll, the extern declaration lacks the .dll:

.assembly extern Squirrel { .ver 0:9:4:0 }

JohnThomson avatar May 21 '15 20:05 JohnThomson

I'm seeing the same things. Can't figure out where that is coming from. Seems like it must be ILRepack but I'm not even qualified to look at that. I tried rebuilding Squirrel and hardcoding the name parameter for ILRepack but no difference.

I'm out of ideas. Time to go mow the lawn, maybe something will hit me then.

PushOrigin avatar May 21 '15 21:05 PushOrigin