# How to properly set up XNA shader?

I'm trying to get a basic shader to work in XNA. I pass in a bool value called "TextureEnabled" to indicate whether or not it should expect some UV texture coordinates. But regardless of what I pass, it is always expecting the UV value, and it throws and InvalidOperationException -"TextureCoordinate0 is missing":

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{

float4 worldPosition = mul(input.Position, World);
float4x4 viewProjection = mul(View, Projection);
output.Position = mul(worldPosition, viewProjection);

if (TextureEnabled == true)
{
output.UV = input.UV; //**// always executes**
}
else
{
output.UV = float2(1, 0);
}

return output;


}

Here's the declaration at the top of the effect file:

float4x4 World;
float4x4 View;
float4x4 Projection;
texture BasicTexture;
bool TextureEnabled = false;


I'm even setting the effect parameter in my XNA Draw() method:

paramName = "TextureEnabled";
effect.Parameters[paramName].SetValue(false);


If I just hard-code output.UV = float2(1, 0) instead of output.UV = input.UV, it does not throw an exception, so I know that has to be the problem. Its almost like the TextureEnabled variable isn't getting set up (or not evaluated), even though I can see SetValue(false) being called in the debugger. What am I doing wrong?

Here's the relevant source files, if needed: http://www.mediafire.com/?g85tc5d9582vs8g