By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,557 Members | 1,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,557 IT Pros & Developers. It's quick & easy.

.Net dynamic call and debuging issue

P: n/a
Tom
Hi .Net Professional :

In recent , I starting to learn about dynamic call .net object in vb.net.

Before, some IT people teach me use the following method and its work !!

Dim asm As [Assembly] =
[Assembly].LoadFrom("D:\vb7Project\dynamicCall\prj01\prj01\b in\prj01.dll")

Dim ty As Type = asm.GetType("prj01.dbLib")
Dim obj As Object = Activator.CreateInstance(ty)
obj.SendMsg()

However, I have face another problem : debug in runtime, I find that it can
allow me trace the program during runtime, e.g. I add breakpoint in the
child object. It will not show it. Therefore, how can I fix it. Actually , I
cannot change the dynamic design into static design(i.e. add reference to
project in design time).

Thanks for your help
..Net student


Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
What do you mean by not allowing breakpoint in child object. Do you mean in
the SendMessage line of inside the object that you are creating. If you want
to debug the object you are creating, you just need to step into the code and
it should be able to debug. Otherwise, open that project(the dynamic code
one) and attach to the caller process and debug.

Rgds,
Anand
http://www.dotnetindia.com

"Tom" wrote:
Hi .Net Professional :

In recent , I starting to learn about dynamic call .net object in vb.net.

Before, some IT people teach me use the following method and its work !!

Dim asm As [Assembly] =
[Assembly].LoadFrom("D:\vb7Project\dynamicCall\prj01\prj01\b in\prj01.dll")

Dim ty As Type = asm.GetType("prj01.dbLib")
Dim obj As Object = Activator.CreateInstance(ty)
obj.SendMsg()

However, I have face another problem : debug in runtime, I find that it can
allow me trace the program during runtime, e.g. I add breakpoint in the
child object. It will not show it. Therefore, how can I fix it. Actually , I
cannot change the dynamic design into static design(i.e. add reference to
project in design time).

Thanks for your help
..Net student


Nov 21 '05 #2

P: n/a
Tom
Ok I tried to give you an example :

The host project create a vbform , in the vbform have create the button and
name as "Button1" ,
the button event is follow :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim asm As [Assembly] =
[Assembly].LoadFrom("D:\vb7Project\dynamicCall\prj01\prj01\b in\prj01.dll")
Dim ty As Type = asm.GetType("prj01.dbLib")
Dim obj As Object = Activator.CreateInstance(ty)
obj.SendMsg()

End Sub

Then I create the child project and attach it in the .net solution which
type is class libary name as "prj01" , in this project, I create the class
name "dbLib"
The code like this
Public Class dbLib
Public Function SendMsg()
MsgBox("a")
End Function
End Class
I have set the break point in the statment "MsgBox("a") " , but it is not
active in runtime.
Of course, I must know that add reference method can trace it. But this is a
dynamic design (like "createobject" method)
Can you tell me how can trace the code in the project "prj01".

Thanks

"Anand[MVP]" <An******@discussions.microsoft.com> bl
news:5E**********************************@microsof t.com g...
What do you mean by not allowing breakpoint in child object. Do you mean in the SendMessage line of inside the object that you are creating. If you want to debug the object you are creating, you just need to step into the code and it should be able to debug. Otherwise, open that project(the dynamic code
one) and attach to the caller process and debug.

Rgds,
Anand
http://www.dotnetindia.com

"Tom" wrote:
Hi .Net Professional :

In recent , I starting to learn about dynamic call .net object in vb.net.
Before, some IT people teach me use the following method and its work !!

Dim asm As [Assembly] =
[Assembly].LoadFrom("D:\vb7Project\dynamicCall\prj01\prj01\b in\prj01.dll")
Dim ty As Type = asm.GetType("prj01.dbLib")
Dim obj As Object = Activator.CreateInstance(ty)
obj.SendMsg()

However, I have face another problem : debug in runtime, I find that it can allow me trace the program during runtime, e.g. I add breakpoint in the
child object. It will not show it. Therefore, how can I fix it. Actually , I cannot change the dynamic design into static design(i.e. add reference to project in design time).

Thanks for your help
..Net student


Nov 21 '05 #3

P: n/a
You basically set the proj1 project properties and set host project to run
when debugging (Project properties/debugging). Then when you run proj1, the
host project starts and your break point gets hit.

Otherwise, attach the running host project in your proj1 project and when
the host creates the object, your breakpoint is hit.

Rgds,
Anand
http://www.dotnetindia.com

"Tom" wrote:
Ok I tried to give you an example :

The host project create a vbform , in the vbform have create the button and
name as "Button1" ,
the button event is follow :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim asm As [Assembly] =
[Assembly].LoadFrom("D:\vb7Project\dynamicCall\prj01\prj01\b in\prj01.dll")
Dim ty As Type = asm.GetType("prj01.dbLib")
Dim obj As Object = Activator.CreateInstance(ty)
obj.SendMsg()

End Sub

Then I create the child project and attach it in the .net solution which
type is class libary name as "prj01" , in this project, I create the class
name "dbLib"
The code like this
Public Class dbLib
Public Function SendMsg()
MsgBox("a")
End Function
End Class
I have set the break point in the statment "MsgBox("a") " , but it is not
active in runtime.
Of course, I must know that add reference method can trace it. But this is a
dynamic design (like "createobject" method)
Can you tell me how can trace the code in the project "prj01".

Thanks

"Anand[MVP]" <An******@discussions.microsoft.com> ¦b¶l¥ó
news:5E**********************************@microsof t.com ¤¤¼¶¼g...
What do you mean by not allowing breakpoint in child object. Do you mean

in
the SendMessage line of inside the object that you are creating. If you

want
to debug the object you are creating, you just need to step into the code

and
it should be able to debug. Otherwise, open that project(the dynamic code
one) and attach to the caller process and debug.

Rgds,
Anand
http://www.dotnetindia.com

"Tom" wrote:
Hi .Net Professional :

In recent , I starting to learn about dynamic call .net object in vb.net.
Before, some IT people teach me use the following method and its work !!

Dim asm As [Assembly] =
[Assembly].LoadFrom("D:\vb7Project\dynamicCall\prj01\prj01\b in\prj01.dll")
Dim ty As Type = asm.GetType("prj01.dbLib")
Dim obj As Object = Activator.CreateInstance(ty)
obj.SendMsg()

However, I have face another problem : debug in runtime, I find that it can allow me trace the program during runtime, e.g. I add breakpoint in the
child object. It will not show it. Therefore, how can I fix it. Actually , I cannot change the dynamic design into static design(i.e. add reference to project in design time).

Thanks for your help
..Net student



Nov 21 '05 #4

P: n/a
Not sure this is much help, but I do exactly the same as you and debugging
works fine.

The only problem I have in debugging which may or may not be related to this
is when I'm running multiple threads, when single stepping seems to get a
bit problematic if two threads are running the code that I'm single stepping
through at the same time.

Regards
Simon
"Tom" <pc***@tomgroup.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
Hi .Net Professional :

In recent , I starting to learn about dynamic call .net object in vb.net.

Before, some IT people teach me use the following method and its work !!

Dim asm As [Assembly] =
[Assembly].LoadFrom("D:\vb7Project\dynamicCall\prj01\prj01\b in\prj01.dll")

Dim ty As Type = asm.GetType("prj01.dbLib")
Dim obj As Object = Activator.CreateInstance(ty)
obj.SendMsg()

However, I have face another problem : debug in runtime, I find that it
can
allow me trace the program during runtime, e.g. I add breakpoint in the
child object. It will not show it. Therefore, how can I fix it. Actually ,
I
cannot change the dynamic design into static design(i.e. add reference to
project in design time).

Thanks for your help
.Net student


Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.