Effect.FromFile IndexOutOfRange exception

Hi all,

I am trying to load a shader using this code:

private Effect LoadShader(string filename, List<string> defines)

{

Effect effect = null;

if (File.Exists(filename))

{

Macro[] macro = new Macro[defines.Count / 2];

for (int i = 0; i < defines.Count; i += 2)

{

macro[i / 2].Name = definesIdea;

macro[i / 2].Definition = defines[i + 1];

}

effect =Effect.FromFile(m_Device, Config.ShaderFilename, macro, null, null, ShaderFlags.None, null);

}

return effect;

}

At line effect =Effect.FromFile(m_Device, Config.ShaderFilename, macro, null, null, ShaderFlags.None, null); the app throws IndexOutOfRangeException. All parameters are valid and I think it worked fine with DirectX December. Does anyone know where is the problem?

I am using DirectX SDK April and .NET Framework 2.0.

Thanks.

[3211 byte] By [netie] at [2007-12-22]