Add-in wont load with the new ADX 2.8

Add-in Express™ Support Service
That's what is more important than anything else

Add-in wont load with the new ADX 2.8
 
Tyson Stolarski




Posts: 38
Joined: 2006-12-01
The previous version was working great. I have now updated to the new 2.8 version, by unistalling the old then reinstalling the new. I have had a few issues since then.

Firstly, I was getting the following exception on startup of Excel:

-------------------------------------------------------------------

BindingFailure was detected

Message: The assembly with display name 'ExcelAddin' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 2. The cause of the failure was: System.IO.FileLoadException: Could not load file or assembly 'ExcelAddin, Version=1.0.2538.24450, Culture=neutral, PublicKeyToken=c5a0d53497499135' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

File name: 'ExcelAddin, Version=1.0.2538.24450, Culture=neutral, PublicKeyToken=c5a0d53497499135'



=== Pre-bind state information ===

LOG: User = CANIS\Tyson

LOG: DisplayName = ExcelAddin, Version=1.0.2538.24450, Culture=neutral, PublicKeyToken=c5a0d53497499135

(Fully-specified)

LOG: Appbase = file:///C:/Tyson/torq/source/MacroView/DotNet/ExcelAddin/bin/Debug/

LOG: Initial PrivatePath = NULL

Calling assembly : (Unknown).

===

LOG: This bind starts in default load context.

LOG: Configuration file C:\Tyson\torq\source\MacroView\DotNet\ExcelAddin\bin\Debug\EXCEL.EXE.config does not exist.

LOG: No application configuration file found.

LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.

LOG: Post-policy reference: ExcelAddin, Version=1.0.2538.24450, Culture=neutral, PublicKeyToken=c5a0d53497499135

LOG: Attempting download of new URL file:///C:/Tyson/torq/source/MacroView/DotNet/ExcelAddin/bin/Debug/ExcelAddin.DLL.

WRN: Comparing the assembly name resulted in the mismatch: Revision Number

ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

------------------------------------------------------------------------

Reading these forums I found a few people with similar issues, to do with not replacing the adxloader.dll file with the new version. So I replaced mine too, leaving the adxloader.dll.manifest file the same. The error then changed to the following on startup:

--------------------------------------------------------------------------

BindingFailure was detected

Message: The assembly with display name 'ExcelAddin' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 2. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'ExcelAddin, Version=1.0.2538.24450, Culture=neutral, PublicKeyToken=c5a0d53497499135' or one of its dependencies. The system cannot find the file specified.

File name: 'ExcelAddin, Version=1.0.2538.24450, Culture=neutral, PublicKeyToken=c5a0d53497499135'



=== Pre-bind state information ===

LOG: User = CANIS\Tyson

LOG: Where-ref bind. Location = C:/Tyson/torq/source/MacroView/DotNet/ExcelAddin/bin/Release/ExcelAddin.dll

LOG: Appbase = file:///C:/Tyson/torq/source/MacroView/DotNet/ExcelAddin/bin/Debug/

LOG: Initial PrivatePath = NULL

Calling assembly : (Unknown).

===

LOG: This bind starts in LoadFrom load context.

WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().

LOG: No application configuration file found.

LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.

LOG: Attempting download of new URL file:///C:/Tyson/torq/source/MacroView/DotNet/ExcelAddin/bin/Release/ExcelAddin.dll.

------------------------------------------------------------------------

At this point I was stumpted. Copying the new adxloader dll seemed to resolve other peoples similar issues. It didnt help mine however. I then tried to clean up everything. I unregistered my add-in. I deleted all the temp files in the bin and obj directories. I deleted the adxloader.dll.manifest file (I dont know why exactly, it didnt seem like this had any data in it apart from the project filename (which hadnt changed), but I tried it anyway). I then re-built everything and re-registered my project. Now I dont get any error message, the add-in simply doesnt load into Excel anymore. No matter what I do I cant get it to work again. I replaced the adxloader manifest file with the original from source control, and still it wont load. I cant even get it back to the previous state with the exceptions mentioned above. Anyone got any idea of whats going on?
Posted 13 Dec, 2006 03:12:53 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Tyson.

Did you rebuild the 'ExcelAddin' with a new ADX version?


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 13 Dec, 2006 13:29:48 Top
Tyson Stolarski




Posts: 38
Joined: 2006-12-01
Yes. I cleaned and rebuilt the entire solution, including the ExcelAddin dll, to ensure all files were built using the new ADX dlls.

Unless there is some special way of rebuilding when you upgrade to a new ADX version??? I cleaned all the files by deleteing the bin and obj directories, then rebuilt them all using the Rebuild Solution button within VS2005.

I just created a small hello world add-in with the new ADX 2.8, which works fine. So I havnt screwed office or excel or anything, and the new version works fine too, its just this individual "ExcelAddin" add-in that has been upgraded to ADX 2.8 that refuses to work.

If you could even point me in the direction to atleast get it loading again (and then throwing the above mentioned exceptions). Atleast then I had some means of debugging. Right now the assemblies are not even attempting to load (Im logging it using the Fusion assembly binding logger tool, and the ExcelAddin dlls are not being mentioned when I start Excel).

Cheers

Tyson.
Posted 13 Dec, 2006 21:20:28 Top
Tyson Stolarski




Posts: 38
Joined: 2006-12-01
Hmmm... I just created a virtual machine with a fresh install of XP and Office 2003 SP2. I then installed the latest build of the "ExcelAddin" and it seems to work fine. Therefor I'm under the impression its just my dev machine that has mixed itself up. Where should I look to clear up old COM add-in garbage?
Posted 13 Dec, 2006 21:37:51 Top
Tyson Stolarski




Posts: 38
Joined: 2006-12-01
Ok. Worked out the first problem. My add-in had been disabled. To re-enable I simply had to go into Excel's Disabled Items dialog (Help -> About Microsoft Office Excel -> Disabled Items...)

However, the original issue still stands now. After upgrading to ADX 2.8, and replacing the adxloader.dll file with the new one, I still get the FileLoadException mentioned above. Here is the log entry from the Fusion Assembly Binder logger.

*** Assembly Binder Log Entry (12/14/2006 @ 12:46:06 PM) ***

The operation failed.
Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = CANIS\Tyson
LOG: DisplayName = ExcelAddin, Version=1.0.2538.24450, Culture=neutral, PublicKeyToken=c5a0d53497499135
(Fully-specified)
LOG: Appbase = file:///C:/Tyson/torq/source/MacroView/DotNet/ExcelAddin/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = EXCEL.EXE
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: ExcelAddin, Version=1.0.2538.24450, Culture=neutral, PublicKeyToken=c5a0d53497499135
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Tyson/torq/source/MacroView/DotNet/ExcelAddin/bin/Debug/ExcelAddin.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Tyson\torq\source\MacroView\DotNet\ExcelAddin\bin\Debug\ExcelAddin.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: ExcelAddin, Version=1.0.2539.22978, Culture=neutral, PublicKeyToken=c5a0d53497499135
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

By the looks of it, the version numbers are different for some reason. The ExcelAddin dll attempting to be loaded has a newer version number than the dll being expected. Why would this be...??? Should the loader attempt to load the latest build???
Posted 13 Dec, 2006 22:47:26 Top
Tyson Stolarski




Posts: 38
Joined: 2006-12-01
Ok... Ive fixed it finally, although it was a bit messy. Has anyone else had issues upgrading their add-in projects to ADX 2.8???

Firstly, I located the AddinModule's GUID key within the registry (it was in HKEY_CLASSES_ROOT\CLSID\{<GUID goes here>}). This contained a key called "InprocServer32". Within this key there was a list of keys named after all the previous assembly version numbers of my project. Looking at the above log, it was searching for the latest version number in this list. However, the assembly it loaded was an even later version than anything listed, so the search failed. I deleted all the old version number keys, except for the latest. I then renamed this to the version number it was looking for. This key also contained a value named "Assembly" that references the version number - I also updated its reference to the new version number.

Going back to VS and running, it worked great. I then did an additional test of unregistering and re-registering, and it still worked - fixed, great!

I thought that the issue I was experiencing was due to my assembly version and the registry keys going out of sync. It made sense, now that I manually sync'ed them up again, it was working. However, I went back to the registry just to have a look, and the whole structure of the "InprocServer32" key had changed. It no longer contained a list of version number keys, but rather contained no keys at all. Instead, it contained the values that each individual version key used to contain. And the "Assembly" value no longer referenced any assembly version at all either. My understanding of all this is that in ADX 2.8 the COM assembly referencing is now independent of assembly version numbers? Now that I had sync'ed up the version numbers, the ADX 2.8 code could go through and re-structure its registry to the new style. What confuses me though is that if the upgrade to ADX 2.8 was buggy, why hasnt anyone else experienced this same issue? Or was it something I did that got my registry into a weird state?
Posted 14 Dec, 2006 02:58:40 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Tyson.

Thank you for your detailed investigation. You are correct. The latest ADX Loader is a version independent dll that doesn't require the registry key with a version number of the add-in assembly. This feature allows you to update add-ins by means of copying a new add-in assembly without registration. Moreover the host application can be running at that moment.
Posted 14 Dec, 2006 06:13:44 Top