Stepping into

  • Thread starter Thread starter Kevin Jackson
  • Start date Start date
K

Kevin Jackson

I have a console application which calls two library ServicedComponents.
I'm in debug mode, all the symbols get loaded but I cannot step into the
method in the ServicedComponents. I can set breakpoints, I just cannot step
into.

Am I an idiot.

VS 2003 .NET
 
Hi Kevin,

Thanks for posting in the community.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to know how to debug a
serviced component.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think you may need to set a break point on the code of the function to be
called.
e.g.
SolutionA has two projects(SC1(Serviced Component), TestSC(Console
Application))

[SC1]
Imports System.EnterpriseServices
Imports System.Runtime.CompilerServices
Imports System.Reflection
Imports System.Runtime.InteropServices
' Supply the COM+ application name.
<Assembly: ApplicationName("TestApp")>
' Supply a strong-named assembly.
<Assembly: AssemblyKeyFileAttribute("..\..\Test.snk")>

Namespace BankComponent
Public Interface IAccount
Function Post(ByVal x As Integer) As Integer
End Interface
<ClassInterface(ClassInterfaceType.None)> _
Public Class Account
Inherits ServicedComponent
Implements IAccount

Public Function Post(ByVal x As Integer) As Integer Implements
IAccount.Post
Return x * x ' Set Break Point at the line
' Updates the database; no need to call SetComplete.
' Calls SetComplete automatically if no exception is generated.
End Function
End Class
End Namespace

[TestSC]
Module Module1
Sub Main()
Dim o As SC1.BankComponent.IAccount = New SC1.BankComponent.Account
Dim i As Integer = o.Post(10) 'Set Break Point on the line
Console.WriteLine(i)
End Sub
End Module

Press F5 the application will run TestSC and hit the break point at the
line
Dim i As Integer = o.Post(10) 'Set Break Point on the line
Press F11 or F5 the IDE will navigate to Class1.vb(SC1) and hit the break
point at the link below.
Return x * x ' Set Break Point at the line

Please apply my suggestion above and let me know if it helps resolve your
problem.

BTW, for server activated COM+ component, you may need to attach the
dllhost.exe who host the com+ object.
http://groups.google.com/groups?hl=zh-CN&lr=&ie=UTF-8&oe=UTF-8&threadm=J2WI3
ndECHA.2512%40cpmsftngxa07&rnum=4&prev=/groups%3Fhl%3Dzh-CN%26ie%3DUTF-8%26o
e%3DUTF-8%26q%3D%2522david%2Byuan%2522%2Bserviced%2Bcomponent%26sa%3DN%26tab
%3Dwg%26lr%3D

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
I forgot to mention that they were library ServicedComponents.

Yes what you mention works but in VB 6.0 I've always been able to step right
into library VB components durectly from the app.

Why can't I "step in" to a library serviced component in VB.NET VS 2003?


Peter Huang said:
Hi Kevin,

Thanks for posting in the community.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to know how to debug a
serviced component.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think you may need to set a break point on the code of the function to be
called.
e.g.
SolutionA has two projects(SC1(Serviced Component), TestSC(Console
Application))

[SC1]
Imports System.EnterpriseServices
Imports System.Runtime.CompilerServices
Imports System.Reflection
Imports System.Runtime.InteropServices
' Supply the COM+ application name.
<Assembly: ApplicationName("TestApp")>
' Supply a strong-named assembly.
<Assembly: AssemblyKeyFileAttribute("..\..\Test.snk")>

Namespace BankComponent
Public Interface IAccount
Function Post(ByVal x As Integer) As Integer
End Interface
<ClassInterface(ClassInterfaceType.None)> _
Public Class Account
Inherits ServicedComponent
Implements IAccount

Public Function Post(ByVal x As Integer) As Integer Implements
IAccount.Post
Return x * x ' Set Break Point at the line
' Updates the database; no need to call SetComplete.
' Calls SetComplete automatically if no exception is generated.
End Function
End Class
End Namespace

[TestSC]
Module Module1
Sub Main()
Dim o As SC1.BankComponent.IAccount = New SC1.BankComponent.Account
Dim i As Integer = o.Post(10) 'Set Break Point on the line
Console.WriteLine(i)
End Sub
End Module

Press F5 the application will run TestSC and hit the break point at the
line
Dim i As Integer = o.Post(10) 'Set Break Point on the line
Press F11 or F5 the IDE will navigate to Class1.vb(SC1) and hit the break
point at the link below.
Return x * x ' Set Break Point at the line

Please apply my suggestion above and let me know if it helps resolve your
problem.

BTW, for server activated COM+ component, you may need to attach the
dllhost.exe who host the com+ object.
http://groups.google.com/groups?hl=...=%22david+yuan%22+serviced+component&sa=N&tab
%3Dwg%26lr%3D

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Kevin,

Thanks for your quickly reply!

I am researching the issue, if I have new information I will upgrate with
you ASAP.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Kevin,

After my further researching, to achieve your aim, you need to declare your
object reference as class type not the interface type.

I have succeeded to step into the Seriviced Component by declaring the
component as below.
Dim o As SC1.BankComponent.Account = New SC1.BankComponent.Account

[TestSC]
Module Module1
Sub Main()
Dim o As SC1.BankComponent.Account = New SC1.BankComponent.Account
'NOTE: at the line we declare the o as Account NOT IAccount
Dim i As Integer
i = o.Post(10) 'Set break point on the line
Console.WriteLine(i)
End Sub
End Module

[Seriviced Component]
Imports System.EnterpriseServices
Imports System.Runtime.CompilerServices
Imports System.Reflection
Imports System.Runtime.InteropServices
<Assembly: ApplicationName("TestApp")>
<Assembly: AssemblyKeyFileAttribute("..\..\Test.snk")>

Namespace BankComponent
Public Interface IAccount
Function Post(ByVal x As Integer) As Integer
End Interface
<ClassInterface(ClassInterfaceType.None)> _
Public Class Account
Inherits ServicedComponent
Implements IAccount
Private Function makedouble(ByVal x As Integer) As Integer
Return x * 2
End Function
Public Function Post(ByVal x As Integer) As Integer Implements
IAccount.Post
Dim y As Integer
x = x + 1
y = x * makedouble(x)
Return y 'Set break point on the line
End Function
End Class
End Namespace

When we are debugging the serviced component, the .PDB files or source code
used by the IDE for the SC should match the DLL configured in COM+. It
seems that you have done that. :)

You may try my suggestion and let me know the result.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top