Unhandled exception in XenFX

Mar 11, 2010 at 4:47 PM
Edited Mar 11, 2010 at 4:50 PM
Hi guys,

I cannot get XenFx to give me a compile error. Even in tutorial 3 it gives the following "Unhandled exception" when i uncommont "//float test = undefinedValue;".

Warning 1 Custom tool warning: Unhandled exception in XenFX: Xen.Graphics.ShaderSystem.CustomTool.CompileExceptionCollection: Exception of type 'Xen.Graphics.ShaderSystem.CustomTool.CompileExceptionCollection' was thrown. at Xen.Graphics.ShaderSystem.CustomTool.Common.ThrowError(String header, String errors, String source) in c:\Users\WindowsUser\Desktop\xen\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\Common.cs:line 105 at Xen.Graphics.ShaderSystem.CustomTool.FX.DecompiledEffect..ctor(SourceShader source, Platform platform) in c:\Users\WindowsUser\Desktop\xen\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\FX\FxDecompiler.cs:line 59 at Xen.Graphics.ShaderSystem.CustomTool.FX.AsmTechnique.ExtractTechniques(SourceShader shader, Platform platform) in c:\Users\WindowsUser\Desktop\xen\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\FX\Technique.cs:line 36 at Xen.Graphics.ShaderSystem.CustomTool.FX.SourceShader.ExtractAsmTechniques() in c:\Users\WindowsUser\Desktop\xen\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\FX\SourceShader.cs:line 100 at Xen.Graphics.ShaderSystem.CustomTool.FX.SourceShader..ctor(String shaderSource, String filename, Boolean extractAsmTechniques) in c:\Users\WindowsUser\Desktop\xen\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\FX\SourceShader.cs:line 82 at Xen.Graphics.ShaderSystem.CustomTool.ShaderCodeGenerator.GenerateCode(String inputFileName, String inputFileContent, String fileNameSpace, CodeDomProvider codeProvider) in c:\Users\WindowsUser\Desktop\xen\xen\src\Xen.Graphics.ShaderSystem\Xen.Graphics.ShaderSystem.CustomTool\PluginEntry.cs:line 40

Here is where it gets strange. 

That directory does not exist! Initially I had xen sitting there but then i moved it to my
project directory. I have tried running the prebuild.bat script over and over but it still thinks
Xen is running from the desktop. If that wasnt odd enough, when i run the unregister.bat tool it
no longer finds the tool. So im confident it is running the tool inside my project directory
(but it doesn't know?).
Also, I have tried editing PluginEntry.cs to handle CompileExceptionCollection but that has
no effect.  Then I tried changing the string "Unhandled exception in XenFX" to something
else but that has no effect...  is it somehow running in a secret directory on my desktop?
(I have checked by telling explorer to show all files... its not there)

ugh, without the compile error's its really hard to code shaders. Please help me out! =(

Mar 11, 2010 at 5:13 PM

I managed to fix it by restarting the computer and adding the following lines to PluginEntry.cs at line 50

catch (CompileExceptionCollection e)
                    CompileException ex = e.GetException(0);
                    this.GeneratorErrorCallback(false, 1, ex.Text, ex.Line, ex.Coloumn);
                    Console.WriteLine(string.Format("Error generating shader: {0} (line: {1} col: {2})", ex.Text, ex.Line, ex.Coloumn));
                    return Encoding.ASCII.GetBytes(SourceDom.GenerateErrorString(ex, codeProvider));

Mar 11, 2010 at 11:17 PM

Yup. I'm not sure how I managed to mess that up - it's in my fix list for the next update, along with a few other little tweaks (whenever that gets released.. :)

At some time a while ago I managed to break *all* the error reporting from the shader system, I fixed the basic case but not this one.