Showing posts with label visual studio. Show all posts
Showing posts with label visual studio. Show all posts

Tuesday, April 06, 2010

Debugging SQL And The Fun Attached To That

Having come across this problem in Commerce Server 2002 recently:
Server Error in '/' Application.

Source:Microsoft OLE DB Provider for SQL ServerDescription:Incorrect syntax near '('.Source:Microsoft OLE DB Provider for SQL ServerDescription:Invalid object name 'MSCS_CatalogScratch.dbo.Catalog__Query__Results__for_spid__304'.Source:Microsoft OLE DB Provider for SQL ServerDescription:Invalid object name 'MSCS_CatalogScratch.dbo.Catalog__Query__Results__for_spid__304'.
I discovered that the stored procedure failing was called "ctlg_GetResults_for_SingleCatalog" but how to work out where?

This page came in useful: http://support.microsoft.com/kb/316549

Basically, it's stepping through SQL Stored Procedures in Visual Studio. The account you're accessing the DB requires execute permissions, etc, of course, but from there you should be able to step through the process just like code. Well, almost.

Sunday, February 21, 2010

The Project Is Not Supported By This Installation

Today I got this error dialog when trying to open a solution "The project file '....csproj' cannot be opened. The project type is not supported by this installation." Visual Studio went on to display all the projects in the solution it could, except the website project.

Googling this returned this helpful post:
Indeed, reading the 5th post on that thread lead me to deleting the ProjectTypeGuids element from within the first PropertyGroup element. Hitting Reload Project in Solution Explorer showed the project correctly.

Friday, February 19, 2010

Different Build Modes

It is often useful to have different Visual Studio build modes in order to make better/more appropriate compilations of your projects for different environments, such as Development (your local dev machine), Staging (internal/client testing) and Production (final, fully live environment.)

To this end setting up VS properly is important and actually fairly simple. The process I use is thus:
  • Create a \Configuration directory in the root of your web project
  • Create \[build mode] directories for each build mode inside the \Configuration directory
  • Open the web project properties panel, click "Build Events" and paste this into the first multi-line text box, titled "Pre-build event command line":
mkdir $(ProjectDir)Configuration\Current
copy $(ProjectDir)Configuration\$(ConfigurationName)\*.config $(ProjectDir)Configuration\Current
  • Create empty ConnectionStrings.config and AppSettings.config files within each of \Configuration\[build mode] directories. These will need the initial empty elements for their appropriate config blocks, such as and
  • Replace the above config blocks in your web.config file with element attributes pointing to the \Configuration\Current directory:
  • Open the Solution Configurations drop down and select "Configuration Manager..." This is on the Standard toolbar and will probably show "Debug" as the default item.
  • Create the appropriate build modes under "Active solution configuration". Select New... and just create a series of new configuration names, such as Development, Staging and Production. Copy the default settings from Debug, for ease of use.
  • Using the Active solution configuration drop down, select each of the configuration modes you've just created and for each one click New... under the "Configuration" column for each project in your solution. When the New dialog opens, just create the configuration with the same name as the active solution's configuration: Development under Development and so on. Again, copy the Debug project configuration, for ease of use.
  • After closing the configuration dialog, select a configuration mode from the drop down and hit Build -> Build Solution.
At this point you may discover the following exception when building:
The command "mkdir .........." exited with code n.

This happens because one of the files you're asking copy to work upon either doesn't exist, doesn't have permissions to access or the directory your command refers to simply isn't there.

Problem: The directory will be missing if your Visual Studio build mode is currently in, for example, Release and you've only got \Configuration directories for, eg, Development and Staging. The problem copy is hitting is that the \Release directory doesn't exist.

Solution: Change the current build mode to Staging or Development and all should be well.

Tuesday, June 30, 2009

Creating A Shortcut To Open Current File In Explorer From Visual Studio

Here's a neat little item that most people won't know about in Visual Studio 2008 - opening the directory of the current file in windows explorer:

Sunday, March 15, 2009

Microsoft links I have yet to read, but really should...

How Do I: Create a Breakpoint
Using Conditions?

How Do I: Create a Breakpoint Using Hit Count?

How Do I; Learn Tips and Tricks for Debugging in Visual Studio?

Office Development with Visual Studio Developer
Center Just Launched!

Microsoft Cloud Computing Tools

How Do I: Add Tool Windows to the Visual Studio IDE?

How Do I: Add a New Tool Window to Visual Studio?

How Do I: Integrate With the Error List?

How Do I: Create a Basic Language Service Using the Managed Babel System?

How Do I: Create Custom
Project Templates Using Visual Studio 2008?

How Do I: Create an Item Template Using Visual Studio 2008?

How Do I: Write to the Output Window?

Explore the New Features of Visual Studio 2008

How Do I: Create a Debugger Visualizer?

How Do I: Place My Commands Into Different Kinds of Visual Studio Menus?

How Do I: Add Commands
and Controls Into the Visual Studio IDE?

How Do I: Get Started with the VisualStudio Domain Specific Languages?

Heroes Happen Here
DotNetNuke® and Visual Studio 2008

Visual Studio Tip of the Day

How Do I: Add AJAX Functionality to an Existing ASP.NET Page?

How Do I: Debug a Windows Presentation Foundation Application in Visual Studio 2008?

How Do I: Use the LINQ-Enabled
XML API in Visual Studio 2008?

Thursday, August 28, 2008

Release Mode missing

I recently realised, after a long time of not caring, that there are two ways to create a web project, with only one allowing Release Mode compilation.

Release Mode allowed: File -> New -> Project -> Visual C# -> Web -> ASP.NET Web Application

Only Debug Mode allowed: File -> New -> Website

Of course, from the command line, both of these options are available, as the options taken when creating any project are simply preset instructions for the compiler switches.

However, I feel it's important to note that only in Release Mode can the source of the website be compiled into a single DLL.

Reference: http://forums.asp.net/p/1053679/1532732.aspx#1532732

Friday, January 11, 2008

Useful MSDN Blog Links and Immutable Classes

The standard feed provided in the Visual Studio 2005 Start Page provides some very useful links. One of them is this:

http://blogs.msdn.com/lucabol/archive/2007/12/28/creating-an-immutable-value-object-in-c-part-iv-a-class-with-a-special-value.aspx

a blog tutorial on creating immutable classes and the clever things to do with them.

I'm hoping to build a large list of really useful links featured on that feed, here.

Yes, yet another list.

Thursday, May 24, 2007

Loader Lock exception in windows applications

Blatantly ripped from: http://www.thezbuffer.com/articles/304.aspx


Error Message:

LoaderLock was detected
Message: DLL '.......\Microsoft.DirectX.Direct3D.dll' is attempting
managed execution inside OS Loader lock. Do not attempt to run
managed code inside a DllMain or image initialization function since
doing so can cause the application to hang.A Loader lock is one of the Managed Debugging Assistants (MDAs) that were added to VS2005 to help find hard to debug runtime issues. There is code in all Managed DirectX 1.1 assemblies that causes this MDA to fire. Microsoft have confirmed they are aware of the problem. However I do not expect to see a fix for MDX 1.1 since current efforts are focused on MDX2.0/XNA Framework, it ONLY affects code run under the debugger (i.e. it won't happen when users run your EXE) and there is a trivial workaround. I'm not sure of exact reproduction steps - it appears to fire on some projects and not on others.

To work around the problem you have several choices:

Go back to using VS2003 and .Net 1.1
Use MDX 2.0. Note that MDX 2.0 will never actually ship as it is being transformed into the XNA framework.
Disable the loader lock MDA. Debug/Exceptions (ctrl-D, E), Open the Managed Debugging Assistants tree node and uncheck Loader Lock. This setting is per solution so it will only affect this solution.
Versions affected:All .Net 1.1 Managed DirectX assemblies when used with Visual Studio 2005 and .Net 2.0.


My apologies, but I will get around to writing my own piece on this particular exception and it's foibles myself when I've got time!