You’ve been staring at the SQL Server view vwCustomersGH for the past hour. The view is part of a project you just started maintaining and like many views and stored procedures in the project you are sure it’s not being used anymore. Because you are a conscientious and professional software developer you want to remove this view along with the others. You don’t want to leave it lying around for the next developer to stumble over like you did, getting confused between the legit vwCustomers and suspicious vwCustomersGH. What does the GH stand for anyway?
[Read More]NUnit Error "Attempted to access an unloaded AppDomain"
I was plagued by the above error but found a workaround, at least one that worked for me. It’s a one line change to the NUnit config file. Note, this the actual NUnit config file that is installed in C:Program FilesNUnit and used by the NUnit GUI/Console executables. Not the config file used by your NUnit project. Find the following line and either remove it or change the value to zero:
[Read More]Upgrading Mini-Compressor to .NET 4.0 Notes Addendum
You can read part one at Upgrading Mini-Compressor to .NET 4.0 Notes post.
One item that I feel has been neglected by Visual Studio is the Setup & Deployment projects. There has been little improvements to them since Visual Studio 2003 but finally VS2010 has new “feature”:
- A customer installs your software using the installer created using VS2008.
- You upgrade your product to .NET 4.0 using VS2010 and create a new MSI.
- The customer runs your new MSI to upgrade their software. After the upgrade is complete nothing is installed at all.
I really do mean nothing, no files in the Program Files folder, no registry entries, shortcuts, etc. The old version is gone along with the new version. It’s a great new feature, I mean bug. The bug is known to Microsoft and you can read more about it here. A summarized description of the error and some workarounds:
[Read More]Starting Any Method in a New Thread Using .NET
The main problem I encountered was creating a function to accept any function pointer along with an unknown number of arguments. I got around this problem using the ThreadStart and delegate() features in C# (.NET 3.5). First off create your method to take any method as so:
public static Thread StartMethodInNewThread(ThreadStart methodToStart)
{
// Do common some stuff before starting the thread, such as logging.
// Start the task in a new thread
Thread t = new Thread(methodToStart);
t.Start();
// Do some stuff after starting the thread, such as more logging.
// If the caller cares you can return the thread.
return t;
}
Now anywhere in your code where you need to start a new method in a thread write the following:
[Read More]