Skip to main content

Posts

Showing posts from July, 2010

Testing COM components

Here's some code you can use to try to load your Type through COM. You can use the GetPEKind method to get the platform that the assembly was compiled for. (Recently ran into a problem where I couldn't be sure the assembly I'd registered was registered correctly, my query was particular to win64, there are some changes in the registry entries for 64bit windows when running 32 bit applications.) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace ComTest { class MyGetTypeFromCLSIDSample { public static void Main() { try { Guid myGuid1 = new Guid("3A21CE6B-8571-4955-9780-BAE1EE3215C0");//my Types GUID, regasm was ran on this assembly. // Get the type associated with the CLSID // and specify whether to throw an exception if an error occurs // while loading the type. //if this shows The typ...

Visual Studio build configuration with x64 "Any CPU"

In Visual Studio you may have noticed, and ignored, the pulldowns in your toolbar which usually contain "Release" "Any Cpu". The "Any CPU" part in particular is of interest especially if you plan on running your apps on Windows 64. These configurations are contained in each project and solution i.e. if you open the projects in a text editor you'll see sections in the XML which contain the settings. These settings are also accessible through the Visual Studio UI via the pulldowns mentioned earlier. The significance of the "Any CPU" is it's telling the compiler to compile the code into assemblies into code which can run on either 32 or 64 bit machines. If your assemblies are used by an application written in 64bit (and of course the app runs on a 64bit machine) then your assemblies will be used in the 64bit context, the same stands for 32bit (of course 32bit apps can also run on 32 or 43 bit machines). 64bit machines have an additional regi...

Roles in ASP.NET

Roles are part of the Authorization in ASPNET i.e. a mechanism to tell if the user has or has not access to resources. Roles are a mechanism to group users into sets of permissions. Roles can reuse already existing groups from windows. Roles can also be linked into a SQL database. Roles are configured on the aspnet websites web.config. http://msdn.microsoft.com/en-us/library/ff647401.aspx

XMLSerializer and .NET CLR (sgen.exe)

You might have spotted on your .NET projects in Visual Studio a radiobutton to turn on/off serialization "Generate serialization assembly" in your project's property's Build tab , so what's that all about? Serialization is a mechanism for recreating .NET objects from text. There's another post in this blog on the topic. So why is this option on your project? in brief it's there as a performance improvement for .NET CLR. .NET serializes the assemblies when loading, if you tick the "Generate serialization assembly" listbox your creating a second assembly to accompany the original, the second assembly , with extension .xmlserialize.dll , will be loaded by the CLR at load load if it exists, this improves performance at load time because now the CLR does not have to serialize the original assembly at load time instead if can just load the already existing second assembly. The second assembly is generated with Visual Studio with a tool called sgen.exe...