Groups | Blog | Home
all groups > dotnet component services > may 2005 >

dotnet component services : testing and Debugging COM+ components


anonymous NO[at]SPAM discussions.microsoft.com
5/3/2005 4:40:37 AM
Hi - I'm having a lot of problems debugging COM+ components.

VS.NET seems to switch between hosting modes in a
indeterminable way - sometimes there is a security context
(i.e not hosted in dllhost) and sometimes its hosted but
can't step into the server code when debugging.

I suspect that this is affected by object pooling, and also
COM+ Admin seems to keep some state of the package even
after uninstalling it using regsvsc /u ...

Also getting error trying to build app as it appears
dllhost has locks on components...

has any one had a similar experience - or be able to
suggest solutions to any of these problems?

Thanks in advance
Brendon.


Olivier Matrot
5/4/2005 12:00:00 AM
The following is probably a goo start. this is working for me !
The main goal is to use/load the serviced component from the global assembly
cache.
If the serviced component interface is modified, regsvcs is requested
(uninstall/install), otherwise it is not needed. Make sure that serviced
component is unloaded before launching client application.


- For the Serviced Component in debug configuration
1) Pre build event :
"C:\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Bin\gacutil.exe" /u ComponentLibraryName
2) Post build event :
"C:\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Bin\gacutil.exe" /i (TargetPath$)


- For the project using the serviced component
Copy local for component reference must be set to false.

To step in code while debugging :
1) Set a breakpoint after first object creation, usually something like :
using ( Library.object = new Library.object() )
2) When the breakpoint is reached, choose 'Debug/Process' in the menu, and
attach to the DLLHost instance.
3) Breakpoint set in the library should be valid after that.

Process Explorer from www.systinternals.com is very usefull to see COM
Surrogate in action (dllhost.exe process).

Is client process is ASP.NET application, make sure to use IISRESET before
running the application in debug mode.

HTH.

[quoted text, click to view]

Brendon
5/9/2005 3:45:32 PM
thanks for your reply

I have switched to using GAC and seems to run more
consistently now - but unfortuantely resets my Com+ package
settings every time I rebuild

Also am interested in the pre/post build events - could
seem to find these anywhere - are they avaiable to VB.NET
projects?

B.



[quoted text, click to view]
Daniel Carbajal [MVP]
5/16/2005 4:33:15 PM
The best approach is to do the debugging as a .NET dll, then when your
component is ready switch to Enterprise Services, you can use conditional
compilation sentences...

Daniel Carbajal
Microsoft MVP

[quoted text, click to view]

AddThis Social Bookmark Button