Reputation: 965
I have a C# project that used SharpDX 2.5.0 and everything was working fine. I moved to the newest stable release of SharpDX, 2.6.2. My project compile fine but fails at runtime because it cannot compile the shaders. I'm using this line of code :
var vertexShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "Base_VS", "vs_4_0");
No matter what the actual content of the shader file is, it fails with the following error :
path/to/my/shader.hlsl(1,1): error X3000: Illegal character in shader file
I thought it was related to the UTF-8 encoding of the file, but trying various encoding did not solve the problem. Has anyone else encountered a similar problem or has a suggestion ?
Upvotes: 3
Views: 1937
Reputation: 1338
It's old but I respond anyway:
The default encoding of new visual studio text files is UTF-8 with BOM. That means that the first 3 characters of your file are 
Those characters are "illegal"
Source:
http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
Upvotes: 5
Reputation: 965
I finally found a solution. In case someone encounters the same situation, here is the workaround I found :
Upvotes: 3