.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

.NET Internals: Rewrite MSIL Code on the Fly with the .NET Framework Profiling API

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

In this article, the author shows how to dynamically rewrite Microsoft Intermediate Language code on the fly using the Profiling API of the CLR. Unlike approaches based on Reflection.Emit, this scheme works with the existing assemblies and doesn't require the creation of proxy or dynamic assemblies. The need for IL code rewriting emerges when you want to make your changes transparent to the client and preserve the identity of classes. This technique can be used for creation of interceptors, pre- and post-processing method calls, and code instrumentation and verification.

Aleksandr Mikunov

MSDN Magazine September 2003

View Complete Post

More Related Resource Links

CLR Profiler: No Code Can Hide from the Profiling API in the .NET Framework 2.0


The common language runtime (CLR) profiling API makes available information about the application domains, assemblies, and classes that are loaded and used in a process, just-in-time (JIT) compiler notifications, memory usage tracking, tracing of events, exception tracking, managed to unmanaged code transitions, and the state of the runtime. And if that weren't enough, you will find a nicely enhanced profiling API in the .NET Framework 2.0. Find out what's coming up in this next version.

Jay Hilyard

MSDN Magazine January 2005

Bar Code Scanners with the .NET Compact Framework

Summary: Learn how to make your applications use bar code scanners in a generic way-ndependent of the specific bar code scanners that are used on different devices. Using the design patterns Façade and Factory, the implementation not only supports multiple bar code scanners, but it also makes it easy to add support for other bar code scanners. After a brief discussion about bar code scanners and the bar code scanner pattern, a download code sample, written in C#, demonstrates the use of the pattern and technologies.

Are You in the Know?: Find Out What's New with Code Access Security in the .NET Framework 2.0


Unlike role-based security measures, code access security is not based on user identity. Instead, it is based on the identity of the code that is running, including information such as where the code came from. Here Mike Downen discusses the role of code access security (CAS) in .NET and outlines some key new features and changes in CAS for the .NET Framework 2.0.

Mike Downen

MSDN Magazine November 2005

High Availability: Keep Your Code Running with the Reliability Features of the .NET Framework


Reliability requires the capacity to execute a sequence of operations in a deterministic way, even under exceptional conditions. This allows you to ensure that resources are not leaked and that you can maintain state consistency without relying on application domain unloading (or worse, process restarts) to fix any corrupted state. Unfortunately, in the.NET Framework, not all exceptions are deterministic and synchronous, which makes it difficult to write code that is always deterministic in its ability to execute a predetermined sequence of operations. In this article Stephen Toub will show you why, and explore features of the .NET Framework 2.0 that help you to mitigate these situations and write more reliable code.

Stephen Toub

MSDN Magazine October 2005

Custom Cultures: Extend Your Code's Global Reach With New Features In The .NET Framework 2.0


The upcoming Microsoft .NET Framework 2.0 adds a number of globalization features that address the important issues of extensibility, standards support, and migration. Here authors Michael Kaplan and Cathy Wissink explain what these features mean to your globalization effort.

Michael Kaplan and Cathy Wissink

MSDN Magazine October 2005

JIT and Run: Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects


There's lots to explore in the .NET Framework 2.0, and plenty of digging to be done. If you want to get your hands dirty and learn some of the internals that will carry you through the next few years, you've come to the right place. This article explores CLR internals, including object instance layout, method table layout, method dispatching, interface-based dispatching, and various data structures.

Hanu Kommalapati and Tom Christian

MSDN Magazine May 2005

.NET Internals: Examine Running Processes Using Both Managed and Unmanaged Code


There are plenty of times when you need to get information on running processes, not the least of which is during performance tuning. Using the techniques in this article and special .NET classes you'll see how to get a process' ID, name, priority, number of threads, kernel handle, and memory consumption, as well as its user-mode, kernel-mode, and total elapsed running time and put them to use in a custom app called AssemblyBrowser.

Christophe Nasarre

MSDN Magazine October 2004

CLR Debugging: Improve Your Understanding of .NET Internals by Building a Debugger for Managed Code


With the release of .NET, the Microsoft scripting strategy has evolved. Script engines can now compile or interpret code for the Microsoft common language runtime (CLR) instead of integrating debugging capabilities directly into apps through Active Scripting. With that change comes a new set of published services for including debugging functionality in a custom host application. You'll see how to use the debugging services published in the .NET Framework to create a full-featured CLR debugger that allows you to set breakpoints, view call stacks, browse variables, view processes, enumerate threads, and perform other important debugging tasks.

Mike Pellegrino

MSDN Magazine November 2002

C# and the Web: Writing a Web Client Application with Managed Code in the Microsoft .NET Framework


When the author wanted to build a middleware Web client to connect to other applications over the Internet, he realized that the XMLHttpRequest COM object was not sufficient for his purposes. In order to build a Web client using managed code, the author had to use the HTTPWebRequest and HTTPWebResponse classes provided by the Microsoft .NET framework. These classes are used in the sample project as a substitute for the less powerful XMLHttpRequest COM object, allowing the author to build a full-featured Web client. They also take advantage of all the benefits that the CLR and managed code have to offer.

Avi Ben-Menahem

MSDN Magazine September 2001

The Weekly Source Code 56 - Visual Studio 2010 and .NET Framework 4 Training Kit - Code Contracts, P

Do you like a big pile of source code? Well, there is an imperial buttload of source in the Visual Studio 2010 and .NET Framework 4 Training Kit . It's actually a 178 meg download, which is insane. Perhaps start your download now and get it in the morning when you get up. It's extremely well put together and I say Kudos to the folks that did it. They are better people than I. I like to explore it while watching TV myself and found myself looking through tonight. I checked my blog and while I thought I'd shared this with you before, Dear Reader, I hadn't. My bad, because it's pure gold . With C# and VB, natch. Here's an outline of what's inside. I've heard of folks setting up lunch-time study groups and going through...(read more)

.NET Framework 4.0 -- Installation failed with error code: (0x80070658), "Error applying transforms.

I’m getting the following error when installing .NET 4.0.   Final Result: Installation failed with error code: (0x80070658), "Error applying transforms. Verify that the specified transform paths are valid"   These are the steps I took to try and solve the problem but no luck:   1.       Uninstalled all versions of .NET 2.       Ran the .NET Cleanup Tool 3.       Installed .NET 4.0 but it failed   Any ideas?   Here is the last part of the log file with error at the bottom:   [9/7/2010, 14:41:57]calling PerformAction on an installing performer [9/7/2010, 14:41:57] Action: Performing actions on all Items... [9/7/2010, 14:41:57]Wait for Item (RGB9RAST_x86.msi) to be available [9/7/2010, 14:42:0]RGB9RAST_x86.msi is now available to install [9/7/2010, 14:42:0]Creating new Performer for MSI item [9/7/2010, 14:42:0] Action: Performing Action on MSI at C:\DOCUME~1\adelgadi\LOCALS~1\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\RGB9RAST_x86.msi... [9/7/2010, 14:42:0]Log File C:\DOCUME~1\adelgadi\LOCALS~1\Temp\Microsoft .NET Framework 4 Setup_20100907_144152567-MSI_RGB9RAST_x86.msi.txt does not yet exist but may do at Watson upload time [9/7/2010, 14:42:0]Calling MsiInstallProduct(C:\DOCUME~1\adelgadi\LOCALS~1\Temp\Microsoft .NET Framework 4 Setup_4.0.3

.NET Framework 4.0 Full package installation failed with error code: (0x80070643)

I am getting an error when installing .net framework 4.0. I am using the full package installer. OS: windows XP Service Pack 3 Windows Update: Current with all security updates. Error: [7/12/2010, 10:50:49]MSI (C:\eb1ddbb12a129b2fddde4054\netfx_Core_x86.msi) Installation failed. Msi Log: Microsoft .NET Framework 4 Setup_20100712_105014316-MSI_netfx_Core_x86.msi.txt [7/12/2010, 10:50:49]PerformOperation returned 1603 (translates to HRESULT = 0x80070643) [7/12/2010, 10:50:49] Action complete [7/12/2010, 10:50:49]OnFailureBehavior for this item is to Rollback. [7/12/2010, 10:50:49] Action: Performing actions on all Items... [7/12/2010, 10:50:49] Action complete [7/12/2010, 10:50:49] Action complete [7/12/2010, 10:50:57]C:\eb1ddbb12a129b2fddde4054\netfx_Extended.mzz - Signature verified successfully for netfx_Extended.mzz [7/12/2010, 10:50:57] C:\eb1ddbb12a129b2fddde4054\netfx_Extended.mzz Signature verified successfully for netfx_Extended.mzz [7/12/2010, 10:50:57]Signature verification succeeded for netfx_Extended.mzz [7/12/2010, 10:50:57]File C:\eb1ddbb12a129b2fddde4054\netfx_Extended.mzz, locked for install. [7/12/2010, 10:50:57]Verifying Digital Signatures: C:\eb1ddbb12a129b2fddde4054\netfx_Extended.mzz Success [7/12/2010, 10:50:57]Final Result: Installation failed with error code: (0x80070643), "Fatal error during installation. " (Elapsed time: 0 00:00

.NET Framework 4 Final Result: Installation failed with error code: (0x80070643)


While trying to install Microsoft Visual Studio 2010 i got some errors on .NET framework 4.0, so i tried the standalone .NET 4 installer from microsoft and i got these errors.

MSI (H:\8c4b5e7f61c15fc5cf9e70de2e\netfx_Extended_x86.msi) Installation failed. Msi Log: Microsoft .NET Framework 4 Setup_20100924_134502282-MSI_netfx_Extended_x86.msi.txt
[9/24/2010, 13:51:7]PerformOperation returned 1603 (translates to HRESULT = 0x80070643)

[9/24/2010, 13:51:7] Action complete

[9/24/2010, 13:51:7]OnFailureBehavior for this item is to Rollback.

[9/24/2010, 13:51:7] Action complete

[9/24/2010, 13:51:7]Final Result: Installation failed with error code: (0x80070643), "Fatal error during installation." (Elapsed time: 0 00:06:05).

sample code for a login control talking to the entity framework


apologies as i am new to the Entity Framework

i have a web-site which uses forms based authentication. thus i have a login page with a login control on it. how would i go about coding the authenticate event of this control to talk to the Entity Framework to validate the user credentials?


any help or sample code (preferably in VB) gratefully appreciated 



Microsoft .NET Framework installation error code 0x80070009


Installation Did Not Succeed

.NET Framework 4 has not been installed because

The storage control block address is invalid.

For more information about this problem, see the log file.

Final Result: Installation failed with error code:

(0x80070009), "The storage control block address is invalid. "

(Elapsed time: 0 00:03:20).

Help with this is appreciated.  I cannot upgrade from Microsoft .NET Framework 3.5 SP1 to 4, and due to this problem, I cannot install Visual Studio or Web Expression.

Thank you.

How to do code profiling for SharePoint application ?

How to do code profiling using clr profiler for SharePoint application in moss 2007 to identify memory consuming methods? Please help its very urgent...

Installation Error of Microsoft .NET Framework 4.0 Error code: (0x800B010B), "Generic trust failure.



I having problems installing Microsoft .NET Framework 4.0. Here is my log file:

OS Version = 6.1.7600, Platform 2
OS Description = Windows 7 - x64 Ultimate Edition 
CommandLine = "C:\Program Files (x86)\MicrosoftNET\Setup.exe" /x86 /x64
TimeZone = W. Europe Daylight Time
Initial LCID = 1053
Using Simultaneous Download and Install mechanism
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend