Tag: .Net

Why to Not Use the System Diagnostics Assert Methods

Do Not Use the System Diagnostics Assert Methods Unless… Assertions should never appear in release code.  Assertions are a debug mechanism for revealing bugs within code during development.  Failed assertions in release code indicate the bug was missed and allow the option of debugging at the assertion location.  However, end users should not be presented […]

Using Marshal.GetDelegateForFunctionPointer() to Execute Assembler With Managed Code

Detecting Virtual Machine Execution I never noticed the Marshal.GetDelegateForFunctionPointer() function in the .NET Framework 2.0 until Devin Jenson posted about using it to run native assembly code from C#.  This was a wonderfully timed post for me as I was just putting together the finishing touches on the code for my how to detect virtual […]

How-To: Detecting Virtual Machine Execution

Detecting Virtual Machine Execution Tutorial Several months ago I cam across some C code that cleverly detected whether a process was running on a Virtual Machine or not.  It uses terms like "redpill" and "matrix" in order to symbolize context within a virtual machine or not.  The code places the SIDT assembler instruction into a […]

Class and New Constraints with Generic Methods

The Need for Generic Methods With Constraints Consider a CommandLineHandler ` class that parses a command line string and populates an arbitrary object with the command line data.  Each property on the arbitrary object would correspond to a switch on the command line and, using reflection, the idea would be to initialize the data with […]

How-to: Calling Web Services Using Basic Authentication

How-to: WebMethods Call Using Basic Authentication I recently made a web services call into WebMethods using basic authentication.  This authentication meant that we needed to modify the WSDL generated classes to handle the authentication. Here’s how it works.  I add a reference to the Web Service (Visual Studio generates the client code for calling the web service).  Then, […]