Roemer

I often get an Not enough storage is available to complete this operation Error when compiling a large Solution. By storage they mean Memory (RAM) in fact.
Visual Studio is limited by how much RAM it will use but theres a trick to increase the Memory it will use.

Quick HowTo:
1.
Windows xp: backup the boot.ini file and then put the /3gb switch in your boot.ini.
Windows Vista: run the following from the visual studio command prompt:
bcdedit /set increaseuserva 3072

2.
– be sure to backup devenv.exe
– using the visual studio command prompt, navigate to c:\program files\microsoft visual studio 9\common7\ide\
– execute the following command:
editbin /largeaddressaware devenv.exe

Here’s the Link to the original entry:

http://stevenharman.net/blog/archive/2008/04/29/hacking-visual-studio-to-use-more-than-2gigabytes-of-memory.aspx

When using a AutoCompleteExtender from the AjaxToolkit, Firefox may show it’s own AutoComplete List over the one you want. To disable that, you need to disable autocomplete on the Field or the entire Form.

To do that, just add an autocomplete="off" to the Textbox in the Markup Code or add the Attribute on Runtime like this:

Textbox1.Attributes.Add("autocomplete", "off");

Today, I tried to add the AjaxControlToolkit Controls to my Toolbox in Visual Studio 2008. But when I selected “Choose Items…” in the Toolbox, Visual Studio just crashed without any Errors.

That could happen because of some defect or deinstalled Toolbox Items.

Here’s how to fix that:

  1. Search the Binary devenv.exe
  2. Start it with the command line Parameter /safemode
  3. Use Choosse Items... in the Toolbox
  4. Click thru all the Tabs
  5. Close Visual Studio
  6. Open Visual Studio normally and it should work again

Some old Visual Studio Solutions may come up with this little annoying error on startup.

Here’s how to fix it:

Open the <yourproject>.vspscc File for the defect Project.
It will look like:

""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "COMPULSORY"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = "http://localhost/<yourproject>.vbproj"
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

Change the Value from ENLISTMENT_CHOICE from COMPULSORY to NEVER and remove the Value from ORIGINAL_PROJECT_FILE_PATH.

The File now looks something like:

""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

Save the File.

Now remove the defect Project from your Solution and re-add it. This basically removes the Line SccProjectEnlistmentChoice<xx> = <yy> from your Solution File and possibly some other legacy Lines.

Now you’re done! Finally got rid of that annoying Message!

Sometimes you want to catch and specially handle an SQL-Timeout.
To do this, just put a try-catch around your SQL-Call and catch the SqlException. Now check the Property Number if it is -2 (which stands for Timeout). That’s it.

Here’s a little Code Example how that could look like:

try
{
	RunSomeSqlQuery();
}
catch (SqlException ex)
{
	// Check if it's a TimeoutException
	if (ex.Number == -2)
	{
		// It is...
		// Do whatever you need
	}
	else
	{
		// Other Type of Exception, re-throw it or whatever
		throw;
	}
}

If you want to simulate a Timeout in your SQL-Statement, just use the WAITFOR DELAY SQL-Statement to block for some Time and therefore results in a Timeout.

Here’s an example to wait for 1 Minute:

WAITFOR DELAY '00:01:00'