vshost.exe

Several times I got the question what the vshost.exe is in Visual Studio Express Editions. If you are familiar with Visual Studio the answer is easy: It is called hosting process. And is described in here:

The hosting process is a feature in Visual Studio 2005 that improves debugging performance, enables partial trust debugging, and enables design time expression evaluation. The hosting process files contain vshost in the file name and are placed in the output folder of your project.”

Visual Studio Features

While working with Web Services in one of my projects, I got some compiler errors: The type of particular namespaces could not be found. Actually, I checked the line and it looked as the namespace – (a Web) reference was not found. However, in the Solution Explorer everything looked fine. If you click the namespace identifier which seems to be wrong, a smart tag appears which allows you to extend the namespace to it’s full identifier. And there you can see, why the compiler finds an error.

Reference Prefix

Cool feature if you know that it is there.

Threading in .NET

If you have some trouble in updating GUI elements in .NET because they are not created by the thread just running, try the following:

delegate void onSensorChangeParameterDelegate(int index, int sensorValue);
void kit_OnSensorChange(int index, int sensorValue)
{
    if (InvokeRequired)
    {
        BeginInvoke(new onSensorChangeParameterDelegate(kit_OnSensorChange), new object[] { index, sensorValue });
        return;
    }
    txtInfo.Text = String.Format("Index={0}, Value={1}", index, sensorValue);
}

 

So the method is handed over to the GUI thread, where txtInfo is a TextField, and processed there. Jon has written a great article about threading in .NET and how it can be done.