Attach the debugger to the Office application you want to debug, for example Winword.exe. In Microsoft Visual Studio® 2003, on the Debug menu, click Exceptions. In the Exceptionsdialog box, select Common Language Runtime Exceptions and in the When the exception is thrown list, select Break into the debugger
. Next, in Visual Studio 2003, hit F5. At first you will get two exceptions related to msosec (if you have more than one managed smart tag installed, you will get more than two msosec related exceptions). Click Continue. You should get a log.
Your log will look something like below for msosec:
A first chance exception of type 'System.IO.FileNotFoundException' occurred in WRDomainSetup
Additional information: File or assembly name msosec, or one of its dependencies, was not found.
A first chance exception of type 'System.IO.FileNotFoundException' occurred in WRDomainSetup
Additional information: File or assembly name msosec, or one of its dependencies, was not found.
You can safely ignore the above as they are expected. Check if your managed smart tag is loaded.
If the problem is related to permission issues, you will get the following policy exceptions:
A first chance exception of type 'System.Security.Policy.PolicyException' occurred in mscorlib.dll
Additional information: Execution permission cannot be acquired.
A first chance exception of type 'System.Security.Policy.PolicyException' occurred in Unknown Module.
Additional information: Execution permission cannot be acquired.
A first chance exception of type 'System.Security.Policy.PolicyException' occurred in Unknown Module.
Additional information: Execution permission cannot be acquired.
A first chance exception of type 'System.Security.Policy.PolicyException' occurred in Unknown Module.
Additional information: Execution permission cannot be acquired.
You can also debug permission issues by looking at combination call stacks, modules, outputs, and so forth and use them to diagnose and narrow down the problems. For example, instead of clicking Continue, click Break, then OK. Next, on the Debug menu, point to Windows and then click Call Stack or Module and so on to analyze the output. After breaking, when you want to continue, hit F5. Whenever you want to break, click Break at the exception point you want to analyze.
The following is an example output file for the IBuySpySmartTag sample showing a successful loading of the managed ibuyspysmarttag_csharp.dll (as denoted by
the message 'IBuySpySmartTag_CSharp': Loaded 'c:\documents and settings\user\local settings\application data\assembly\dl2\ljp2r6jm.0m0\k4xjt2yt.nw7\ba930a93\00642ea1_9f62c301\ibuyspysmarttag_csharp.dll', Symbols loaded):
'DefaultDomain': Loaded 'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded.
'DefaultDomain': Loaded 'WRDomainSetup', No symbols loaded.
'DefaultDomain': Loaded 'c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll', No symbols loaded.
A first chance exception of type 'System.IO.FileNotFoundException' occurred in WRDomainSetup
Additional information: File or assembly name msosec, or one of its dependencies, was not found.
A first chance exception of type 'System.IO.FileNotFoundException' occurred in WRDomainSetup
Additional information: File or assembly name msosec, or one of its dependencies, was not found.
'Domain2': Loaded 'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'WRDomainSetup', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system
\1.0.5000.0__b77a5c561934e089\system.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system.drawing1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system.data
\1.0.5000.0__b77a5c561934e089\system.data.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system.directoryservices
\1.0.5000.0__b03f5f7f11d50a3a\system.directoryservices.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system.messaging
\1.0.5000.0__b03f5f7f11d50a3a\system.messaging.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system.serviceprocess
\1.0.5000.0__b03f5f7f11d50a3a\system.serviceprocess.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\documents and settings\user\local settings\application data\assembly
\dl2\ljp2r6jm.0m0\k4xjt2yt.nw7\ba930a93\00642ea1_9f62c301\ibuyspysmarttag_csharp.dll', Symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\microsoft.office.interop.smarttag
\11.0.0.0__71e9bce111e9429c\microsoft.office.interop.smarttag.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system.xml
\1.0.5000.0__b77a5c561934e089\system.xml.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system.windows.forms
\1.0.5000.0__b77a5c561934e089\system.windows.forms.dll', No symbols loaded.
'IBuySpySmartTag_CSharp': Loaded 'c:\windows\assembly\gac\system.web.services
\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll', No symbols loaded.
In the foregoing example, all the assemblies (smart tag assembly, PIAs) were successfully loaded. If your managed smart tag assembly calls into other assemblies, you will need to grant them full trust permissions as well and check that they also get loaded. For more information on granting explicit full trust permissions to IAs and dependent assemblies, see Granting Full Trust Permissions to Interop and Dependent Assemblies topic.