Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / April 2007

Tip: Looking for answers? Try searching our database.

debugging dynamic code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MoriCristian - 30 Mar 2007 12:20 GMT
Hi.
I want to debug in an app written by me (not in vs) in step by step a
routine copiled using the microsoft.csharp.compiler.
Is there any way to do so?
Thanks
Cristian Mori
Wibberlet - 30 Mar 2007 15:50 GMT
Hi MoriCristian,

I am not quite sure what you mean here...do you want to debug an assembly
that has been compiled to IL where you do not have the associated source code?

Debugging IL is possible but certainly not easy and there will be
compromises that you have to make because of the way sequence points are
generated. Sequence points essentially map between IL instructions and native
instructions.

Depending on the size of the assembly it may be possible for you to convert
the IL code back in to source code using a tool such as .Net reflector. If
this is not possible then you could take a look at the managed debugger
located here: http://blogs.msdn.com/jmstall/archive/2004/09/30/236281.aspx.
It is restricted to #2 of the framework and is really not recommended as a
production strength utility. I guess it depends on how desperate you are to
get into the assembly.

I hope I have understood your problem properly, please let me know if that
is not the case.

wibbleret
Development blog at http://wibberlet.blogspot.com

====================================================

> Hi.
> I want to debug in an app written by me (not in vs) in step by step a
> routine copiled using the microsoft.csharp.compiler.
> Is there any way to do so?
> Thanks
> Cristian Mori
MoriCristian - 30 Mar 2007 20:08 GMT
Gi wibbleret, thanks for your reply
I need to add dynamic "scripting" in c# to a program I made (this program is
also made in c#)
I want to open an internal  editor from my program, load my source file,
compile it and debug it. All this while the other components of my program
continue running.
I hope I made myself clearer.
Do you think you can help me with this issue?

Thanks
Cristian Mori

> Hi MoriCristian,
>
[quoted text clipped - 28 lines]
> > Thanks
> > Cristian Mori
Wibberlet - 01 Apr 2007 13:48 GMT
Hi,

You can attach referenced code that you have written to a running process
and then debug your code when it is called (assuming you have the source
code); your reply here implies that perhaps you do.

The process is described here
http://msdn2.microsoft.com/en-us/library/c6wf8e4z.aspx

You can attach to multiple processes at once if required. I guess it all
depends on how you are referencing your dependant assemblies.

regards wibbleret
Development blog at http://wibberlet.blogspot.com

===================================================

> Gi wibbleret, thanks for your reply
> I need to add dynamic "scripting" in c# to a program I made (this program is
[quoted text clipped - 40 lines]
> > > Thanks
> > > Cristian Mori
MoriCristian - 01 Apr 2007 13:56 GMT
the problem is that i do not want to use vs to debug the script.
the debugger must be inside my app, so iI need to have a debugger that dubug
the dynamic code generate insie my app inside itself.

cristian

> Hi,
>
[quoted text clipped - 57 lines]
> > > > Thanks
> > > > Cristian Mori
Wibberlet - 01 Apr 2007 15:16 GMT
Hi Cristian,

My apologies for not quite understanding your requirements. Given what you
are trying to do I think your only chance is to look at something like
Cordbg.exe that ships with the framework SDK (including source code I
believe). http://msdn2.microsoft.com/en-us/library/a6zb7c8d(vs.80).aspx

There is also DbgCLR.exe
http://msdn2.microsoft.com/en-us/library/7zxbks7z(VS.80).aspx which may be
suitable for what you are trying to do. This provides a graphical UI for
debugging services.

Other than that you are probably stuck with the VS IDE (and the licensing
fee) or a free utility such as SharpDevelop altho this would have to be
spawned as a separate process from your application (which is of course what
you are trying to avoid).

regards wibbleret
Development blog at http://wibberlet.blogspot.com

=====================================================

> the problem is that i do not want to use vs to debug the script.
> the debugger must be inside my app, so iI need to have a debugger that dubug
[quoted text clipped - 63 lines]
> > > > > Thanks
> > > > > Cristian Mori
MoriCristian - 01 Apr 2007 18:14 GMT
thanks for your reply.
I'll take a look at the samples you gave me, maybe i'll find a way.
Anyway I want to point that i need to avoid vs not for fee issues, but
becaouse in out toolkit we neet to implement a c# script engine and a
debugger for those scripts, so vs cannot be used as debugging engine and
another way must be found

Thanks
Cristian Mori

> Hi Cristian,
>
[quoted text clipped - 85 lines]
> > > > > > Thanks
> > > > > > Cristian Mori
Jeffrey Tan[MSFT] - 02 Apr 2007 08:38 GMT
Hi Cristian,

Based on my understanding, your application is dynamically generating C#
code through microsoft.csharp.compiler. Now, you want to employ a debugging
function in your own application to debug the generated C# code step by
step. If I have misunderstood you, please feel free to tell me, thanks.

Based on my knowledge, the CLR debugging feature is exposed through
ICorDebug as managed debugging service. So your application may leverage
this interface to get debugging feature. The CLR team has implemented a
sample C# debugger MDbg with source code available. All the best resource
regarding MDbg is maintained here:
"MDbg Linkfest"
http://blogs.msdn.com/jmstall/archive/2005/11/08/mdbg_linkfest.aspx

The CLR developer Mike Stall also created a category regarding MDBG below:
http://blogs.msdn.com/jmstall/archive/tags/MDbg/default.aspx

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.