Posts

Showing posts with the label .NET Framework

Managed code and unmanaged code in .NET

Image
In this article I will try to explain you managed code and unmanaged code in .NET with help of diagram and its execution process. .NET supports two kind of coding Managed Code Unmanaged Code Managed Code The resource, which is with in your application domain is, managed code. The resources that are within domain are faster. The code, which is developed in .NET framework, is known as managed code. This code is directly executed by CLR with help of managed code execution. Any language that is written in .NET Framework is managed code. Managed code uses CLR which in turns looks after your applications by managing memory, handling security, allowing cross - language debugging, and so on. Unmanaged Code The code, which is developed outside .NET, Framework is known as unmanaged code. Applications that do not run under the control of the CLR are said to be unmanaged, and certain languages such as C++ can be used to write such applications, which, for example, access low - level functi...

.NET Framework and Architecture

Image
This article will help your in understanding .NET and .NET architecture. What is the .NET Framework? The .NET Framework is a new and revolutionary platform created by Microsoft for developing applications . It is a platform for application developers . It is a Framework that supports Multiple Language and Cross language integration. IT has IDE (Integrated Development Environment). Framework is a set of utilities or can say building blocks of your application system. .NET Framework provides GUI in a GUI manner. .NET is a platform independent but with help of Mono Compilation System (MCS). MCS is a middle level interface. .NET Framework provides interoperability between languages i.e. Common Type System (CTS) . .NET Framework also includes the .NET Common Language Runtime (CLR), which is responsible for maintaining the execution of all applications developed using the .NET library. The .NET Framework consists primarily of a gigantic library of code. Definition: A programming infrastr...

Check NUnit test results from .bat script

Problem overview If you use NUnit you can run the tests using nunit-console utility from your build script. But this test runner just shows the results in console window and saves a report in XML file. There is no functionality which allows to check the results of testing after nunit-console utility execution and perform some actions depending on these results. Of course there are some powerful build tools which allows to do it, for example NAnt or FinalBuilder. But what should you do if you still use simple .bat files to build your product? The most significant problem: how could you stop build process if some unit test failed? Proposed solution CheckTestResults utility helps to solve this issue. It can analize TestResult.xml file produced by nunit-console utility, shows all found failures, sounds a beep for each failure and finally it stops execution and wait for user input if there was at least one failure during testing. The utility is written on C# and requires .N...

Configuring Terminal Services Gateway using WMI

Image
Introduction This article is about WMI and Terminal Services Gateway. You can find a way to manage your TS Gateway server remotely by using WMI. Here I describe two methods, to add and to remove a Resource Authorization Policy (RAP). All code blocks are picked from proof-of-concept demo and they do not represent "in production" state of the code. Background Employees that are away from the office premises are in constant need of accessing internal resources. Letting people to access their own office computer gives most familiar feeling while being away. Opening such a connections from the Internet some measures to secure, manage and handle these connection were needed. To do this without burdening the administrators, an automatic service that does the Terminal Services Gateway configuration for the end-user was developed. This article shows a way to manage one part of TS Gateway server configuration. Using the Code System.Management namespace needs to be added...

NATO Phonetics

Image
Introduction This article is about compensating for verbal communication misunderstandings; sounds deceptive, but simple and easy. To give an example, suppose you are administering a system remotely, you need to check a command by talking to a technician on the other end of the telephone, and you are unsure if you got the spelling right maybe due to cultural aspects or an illness affliction (think - head cold which can dramatically alter your speech/accent/pronunciation) - you could end up making a mistake and possibly creating even more work. Amendment ( 5 th July 2009 ): As PIEBALDconsult has pointed out, the article shall also reflect how to solve this problem using Generics. I took the long way as to show how the problem can be solved instead of going down the shorter route. To quote from Wikipedia's article on NATO Phonetics " The NATO phonetic alphabet, more formally the international radiotelephony spelling alphabet, is the most widely used spelling alp...

Fast Asynchronous Delegates in .NET

Introduction This article describes how to implement a delegate which performs much better during BeginInvoke / EndInvoke operations, than the delegates with default implementation of BeginInvoke / EndInvoke injected by CLR. The idea is rather simple, no cheats with IL and function pointers. Background In .NET, there is 3 ways to execute an operation or a task asynchronously. The first approach consists in using of System.Threading.ThreadPool , which suits the best in most cases. The second approach is Thread.Start , which fits better than ThreadPool , for the cases of long-running operations. And the last one is APM pattern (pair of methods Begin Something / End Something ) provided by all delegates and some major classes, like Stream , WebRequest , etc. APM pattern suits the best when you need to retrieve a result of an asynchronous operation. Let's consider more closely delegates in .NET. Each delegate in .NET is decorated by C# compiler with such methods as B...