Meeting the needs of your business from a distance

Windows Interface Guidelines

by mark shiffer 9. February 2011 16:06

For what it is worth there is a Windows User Experience Interaction Guidelines document that goes into great detail on how to ‘properly’ design a Windows UI. It will even tell you how many pixels a Cancel button should be from the lower and right side of a dialog.

With the advent of WPF and more unique / natural user interfaces I’m not sure how much coding to the specific guidelines matters any longer. However, I am assuming they take things such as this into account when certifying software for Windows Logo and the like.

Tags:

WPF and Silverlight Examples

by mark shiffer 9. February 2011 16:00

One of the Visual Studio tester folks has a pretty cool website demonstrating various techniques and designs using WPF and Silverlight. Worth checking out: http://www.nokola.com

Tags:

Microsoft Biology Initiative

by mark shiffer 9. February 2011 15:58

The Microsoft Biology Initiative (MBI) is an effort in Microsoft Research to bring new technology and tools to the area of bioinformatics and biology. This initiative is comprised of two primary components, the Microsoft Biology Foundation (MBF) and the Microsoft Biology Tools (MBT).

Microsoft Biology Foundation
The Microsoft Biology Foundation (MBF) is a language-neutral bioinformatics toolkit built as an extension to the Microsoft .NET Framework—initially aimed at the area of Genomics research. Currently, it implements a range of parsers for common bioinformatics file formats; a range of algorithms for manipulating DNA, RNA, and protein sequences; and a set of connectors to biological web services such as NCBI BLAST. MBF is available under an open source license, and executables, source code, demo applications, and documentation are freely downloadable from the project page. Learn more...

Microsoft Biology Tools
The Microsoft Biology Tools (MBT) are a collection of tools that enable biology and bioinformatics researchers to be more productive in making scientific discoveries. The tools in this catalog are free and, when available, include links to the source code and open source collaboration projects. Browse the catalog...

Tags:

Advanced Debugging in Visual Studio

by mark shiffer 9. February 2011 15:56

It is not often that I need to dig into the bowels of a system by pulling out WinDbg to examine the heap memory. I often stumble through the command syntax and/or try to find a quick reference (one of which I have posted previously on this blog). The following post from the Is This Thing On? blog entitled The Immediate Window: Running WinDbg and SOS (Son of Strike) Commands, could help reduce the need for working in WinDbg directly for some issues though. I am reposting the article here for future reference:

 

I could take a long time to teach you about WinDbg and SOS (Son of Strike) so I will avoid that here.  I want to give you a quick view into how SOS works in the Immediate Window.  If you want to get hardcore with debugging then the absolute best places to learn are these two blogs:

John Robbins over at Wintellect:  http://www.wintellect.com/CS/blogs/jrobbins/default.aspx

Tess Ferrandez an ASP.NET Escalation Engineer at Microsoft:  http://blogs.msdn.com/b/tess/

Loading SOS In The Immediate Window

With that said, let's take a look at what it takes to get SOS going in the Immediate Window.  As we go along I will also show you the most common messages you will encounter when trying to set this up.  First, open the Immediate Window (CTRL + ALT + I) and put in ".load sos" then press ENTER.

x86

You will most likely get this message:

"SOS not available while Managed only debugging.  To load SOS, enable unmanaged debugging in your project properties."

The fix is, obviously, to go to your project properties (the Debug tab):

image002

and enable unmanaged debugging:

image004

Now go back to the Immediate Window and type ".load sos" again.  It may take a few seconds but eventually you will see this message (your version will be different based on the CLR being used):

image006

x64

If you get this message:

"Error during command: extension C:\Windows\Microsoft.NET\Framework64\v4.0.30319\sos.dll could not load (error 193)"

Then that means you are attempting to debug an x64 (64 bit) application.  There is no support for interop (managed / unmanaged) debugging on x64 currently in Visual Studio.  You can fix this by going to the project properties (Compile tab) and clicking on the "Advanced Compile Options" button:

image008

Then change the "Target CPU" to x86:

image010

Using SOS

Threads and Symbols

You can now get all kinds of great information.  Type "!threads" to see threading info:

image012

Do you see the error that says "PDB symbol for clr.dll not loaded"?  This is a common error that is trying to tell you that you need to get symbols (http://en.wikipedia.org/wiki/Debug_symbol).  The easiest way to do this is to go to Tools -> Options -> Debugging -> Symbols and check the "Microsoft Symbol Servers" box in the symbol file locations area:

image014

Dump the Managed Heap

You can dump the managed heap by typing "!dumpheap".  Just watch out as this is pretty verbose output by default:

image016

image018

Current Thread Call Stack

If you want to display the call stack for the current thread you can use "!clrstack".  Here is a sample of the output:

image020

These are just a few of the commands you can use.  You can get as deep or as shallow into this as you want but the moral of this story is you can run WinDbg and SOS commands from the Immediate Window.  Very cool stuff!

Tags:

.NET Attribute Keywords

by mark shiffer 9. February 2011 15:43

I ran across this list of attributes for .NET that while it is not comprehensive, it did appear useful to keep around for future reference. The list was provided originally on the DevCurry blog in a post entitled Attributes Every .NET Developer Should Know About.

.NET Attribute

Description

AttributeUsage When you are defining your own attribute class, you can control the manner in which it is used by placing an AttributeUsageAttribute on your attribute class
CLS Compliant Indicates whether a program element is compliant with the Common Language Specification (CLS)
Conditional Indicates to compilers that a method call or attribute should be ignored unless a specified conditional compilation symbol is defined
Debuggable Modifies code generation for runtime just-in-time (JIT) debugging
DebuggerDisplay Determines how a class or field is displayed in the debugger variable windows
DebuggerStepThrough Debugger does not stop in a method marked with this attribute but does allow a breakpoint to be set in the method
DefaultValue Specifies the default value for a property
DesignerSerializationVisibility Specifies the type of persistence to use when serializing a property on a component at design time
Description Specifies a description for a property or even
DisplayName Specifies the display name for a property, event, or public void method which takes no arguments
DllImport Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point
EditorBrowsable Specifies that a property or method is viewable in an editor
Flags Indicates that an enumeration can be treated as a bit field; that is, a set of flags
InternalsVisibleTo Specifies that types that are ordinarily visible only within the current assembly are visible to a specified assembly
MTAThread Indicates that the COM threading model for an application is multithreaded apartment (MTA)
NonSerialized Indicates that a field of a serializable class should not be serialized
Obsolete Marks the program elements that are no longer in use
ParamArray Indicates that a method will allow a variable number of arguments in its invocation
Serializable Indicates that a class can be serialized
WebMethod Adding this attribute to a method within an XML Web service created using ASP.NET makes the method callable from remote Web clients
WebService Used to add additional information to an XML Web service, such as a string describing its functionalit
XMLIgnore Instructs the Serialize method of the XmlSerializer not to serialize the public field or public read/write property value
XMLElement Indicates that a public field or property represents an XML element when the XmlSerializer serializes or deserializes the object that contains it
XMLRoot Controls XML serialization of the attribute target as an XML root element
XMLText Indicates to the XmlSerializer that the member must be treated as XML text when the class that contains it is serialized or deserialized
ThreadStatic Indicates that the value of a static field is unique for each thread

Tags:

Command Line Utilities for .NET

by mark shiffer 9. February 2011 15:38

I ran across a list of command line tools in a nice, succinct format in a blog post at DevCurry entitled Important .NET Framework 4.0 Command Line Tools You Must Know. It looks like a list that would be handy to have around, so I am reposting it here:

Tools

Description

Al.exe (Assembly Linker) The Assembly Linker generates a file that has an assembly manifest from one or more files that are either modules or resource files.
Gacutil.exe (Global Assembly Cache Tool) The Global Assembly Cache tool allows you to view and manipulate the contents of the global assembly cache and download cache.
Ilasm.exe (MSIL Assembler) The MSIL Assembler generates a portable executable (PE) file from Microsoft intermediate language (MSIL)
Ildasm.exe (MSIL Disassembler) The MSIL Disassembler is a companion tool to the MSIL Assembler (Ilasm.exe). Ildasm.exe takes a portable executable (PE) file that contains Microsoft intermediate language (MSIL) code and creates a text file suitable as input to Ilasm.exe.
Installutil.exe (Installer Tool) The Installer tool is a command-line utility that allows you to install and uninstall server resources by executing the installer components in specified assemblies
Mage.exe (Manifest Generation and Editing Tool) and MageUI.exe The Manifest Generation and Editing Tool (Mage.exe) is a command-line tool that supports the creation and editing of application and deployment manifests.
Ngen.exe (Native Image Generator) The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer
Regasm.exe (Assembly Registration Tool) The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently.
Regsvcs.exe (.NET Services Installation Tool)

The .NET Services Installation tool loads and registers an assembly, generates, registers, and installs a type library into a specified COM+ application and configures services that you have added programmatically to your class.

Resgen.exe (Resource File Generator) The Resource File Generator converts text (.txt or .restext) files and XML-based resource format (.resx) files to common language runtime binary (.resources) files that can be embedded in a runtime binary executable or compiled into satellite assemblies.
Storeadm.exe (Isolated Storage Tool) The Isolated Storage tool lists or removes all existing stores for the current user.

Security Tools

Tools

Description

Caspol.exe (Code Access Security Policy Tool) The Code Access Security (CAS) Policy tool (Caspol.exe) enables users and administrators to modify security policy for the machine policy level, the user policy level, and the enterprise policy level
Certmgr.exe (Certificate Manager Tool) Manages certificates, certificate trust lists (CTLs), and certificate revocation lists (CRLs).
Makecert.exe (Certificate Creation Tool) The Certificate Creation tool generates X.509 certificates for testing purposes only. It creates a public and private key pair for digital signatures and stores it in a certificate file
Mscorcfg.msc (.NET Framework Configuration Tool) The .NET Framework Configuration tool (Mscorcfg.msc) is a Microsoft Management Console (MMC) snap-in that enables you to manage and configure assemblies in the GAC and adjust code access security policy
Peverify.exe (PEVerify Tool) Helps you verify whether your Microsoft intermediate language (MSIL) code and associated metadata meet type safety requirements.
SignTool.exe (Sign Tool) Sign Tool is a command-line tool that digitally signs files, verifies signatures in files, and time-stamps files.
Sn.exe (Strong Name Tool) The Strong Name tool (Sn.exe) helps sign assemblies with strong names. Sn.exe provides options for key management, signature generation, and signature verification.

Debugging Tools

Tools

Description

Fuslogvw.exe (Assembly Binding Log Viewer) Displays information about assembly binds to help you diagnose why the .NET Framework cannot locate an assembly at run time.
MDbg.exe (.NET Framework Command-Line Debugger) and Sos.dll The NET Framework Command-Line Debugger helps tools vendors and application developers find and fix bugs in programs that target the .NET Framework common language runtime.

Interop Tools

Tools

Description

Tlbexp.exe (Type Library Exporter) The Type Library Exporter generates a type library that describes the types defined in a common language runtime assembly.
Tlbimp.exe (Type Library Importer) The Type Library Importer converts the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly

Tags:

Copyright © 2001-2013 MS Consulting, Inc. All Rights Reserved.