Visio program problems

Roger BillsdonRoger Billsdon Posts: 14
edited August 6, 2010 9:39AM in SmartAssembly 5
There seems to be some problems with Smart Assembly and certain aspects of Microsoft Visio and Access interop. I’m programming using VB2010 and Visio 2007 and at present I’m testing on Windows XP 32 bit.

If the program is protected using the SmartAssembly defaults all is well. However, I need to be able to decode StackTraces and when the SmartAssembly check box that allows access to the “obfuscate using ASCII characters” is checked, the obfuscated program crashes with the error “could not load type Microsoft.Office.Interop.Visio.EApplication_Event from assembly”. (A similar error occurs when using Microsoft Access interop.)

I’ve found this error can be worked around by adding Microsoft.Office.Interop.Visio to the SmartAssembly exclusion list.

I’ve also found that the Visio select shape method fails in certain circumstances. It throws an error: "Specified cast is not valid" and fails to select a shape. Unfortunately I haven’t been able to reproduce this problem in a small test program, but in the main program I’m currently testing I’ve found that setting the Visio ShowChanges property to false, cures the problem.

I obtained SmartAssembly earlier this week and have only just started testing. While I’m happy to use these work-arounds I’m a little concerned that other similar problems might emerge with more testing. Therefore, I was wondering if anyone could shed any light on what might be causing these problems and if there were any useful pointers that might help guide me.

Sorry for the long-winded explanation, but any help would be much appreciated.
Best regards


  • Thanks for your comprehensive explanation- its very helpful to us in trying to track down possible causes. I'm not aware of any further problems with Visio or Access assemblies but I'll do a more comprehensive support database search and see if there is a pattern to all of this.
  • Hi all
    Having done some more testing it now seems that simply setting the Visio ShowChanges property to false doesn't always cure the problem with the Select method. Something curious is clearly going on.

    Slaphead99: Did you find anything in your support database in relation to this specific type of problem or more generally with SmartAssembly obfuscation of programs that use interop to work with any of the Microsoft Office programs or, indeed, any program that use any COM interop?

    Many thanks
  • As I was saying in your other post- I think the root of all the issue found may be reflection (or any other technology based on serialisation). What I didn't say was that, in addition to controlling exclusions via the GUI, you can also use declarations within your code - more information is here: ... 032253.htm
  • Hi Slaphead
    As far as I'm aware the program I’m testing doesn't use reflection or serialisation.

    It does use Microsoft.Office.Interop.Visio which I believe is basically the same COM interop technology as is used to program against the other Microsoft Office products including Access, Word, Excel, etc. Does this Microsoft Office or COM interop technology use reflection or serialisation?

    As I've excluded Microsoft.Office.Interop.Visio from both obfuscation and pruning I thought that would have excluded all the Visio methods and have obviated the need for adding attributes anywhere else in the program where the Visio methods are called? Because calls to the Visio API are littered throughout this program I can’t believe that would be necessary because the problems seem to be limited to only a few Visio methods like Select and Layer.Add.

    Does anyone use SmartAssembly to obfuscate programs that use interop for Visio or for any of the other Microsoft Office programs or, failing that, any COM interop? If so, are there any guidelines that would help me narrow down the Visio methods that I need to test for problems and do they have any helpful hints or pointers for solutions, etc?

    Many thanks
  • I only get to hear what people are doing when they get a problem and there don't seem to be many issues of this kind at all. I searched again and found one issue and that was due to merging a 3rd party dll into their assembly. Can you clarify what options you are using- specifically, perhaps, which options that change any 3rd party assembly. (I would generally dissuade anyone from doing anything with a 3rd party assembly- except to say embedding is usually benign).
Sign In or Register to comment.