• 10
• 10
• 12
• 12
• 14

# SlimDX Effect.FromFile error from MiniTri Sample

This topic is 3506 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm new to SlimDX and have been trying to get the September 2008 Direct3D10 MiniTri sample running. I continue to have exceptions from Effect.FromFile. The .fx file appears valid and is in the correct directory. The output window shows "Module Not Found" for the exception. I haven't figured out how to download and debug the source (yet), but on inspection I find that the signatures of the two FromFile calls do not match in the Effect.cpp and Effect.h files. (The pool and include arguments do not appear in the .cpp file but are in the .h file - and the SlimDX documentation.) Any help would be appreciated.

##### Share on other sites
Can you perhaps explain more about your problem? I have no troubles running the D3D10 MiniTri sample here. Also, I'm not sure what you mean when you say that the two function signatures are different. I took a look and they are not.

Did you remember to run the SlimDX installer before trying to run the samples? If you didn't, they won't be able to find the SlimDX DLL and will mostly likely fail with some sort of assembly load exception.

##### Share on other sites
Thanks for the quick response. I did use the SlimDX installer. In fact, I've successfully used SlimDX with the XAudio2 components for a project I've just completed. I wanted to explore Direct3D 10 as a possibility for reworking an existing plotting library.

On my system, using the September 2008 version, when MiniTri attempts to execute its Effect.FromFile call (line 107 of Program.cs), I get the output shown between the lines below.

----
A first chance exception of type 'System.Runtime.InteropServices.SEHException' occurred in SlimDX.dll
An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in SlimDX.dll

Additional information: External component has thrown an exception.
----

My investigation of Effect.cpp and Effect.h are from what I could see when browsing at

The files there appear to have mis-matched call sites. If the C# DllImport used the form in the .h file and the .cpp file was as I found it, an error like this would result. (I spent all last summer wrapping a C++ calculations library for .NET use, so I've seen many errors like this.)

I've tried to download SlimCX sources using TortoiseSVN and checkout commands similar to the one provided at

but have never been able to connect with the server. I'm not familiar with SVN yet though, so that problem could well be user error.

##### Share on other sites
Something doesn't sound right about that. If the application was unable to find the fx file, it would throw a Direct3D10Exception. An SEHException implies something deeper than that.

I'd suggest downloading from source and trying it there. You can then use unmanaged debugging coupled with the debug runtimes to see what's going. The problem you are seeing is in your checkout string. It should be "http://slimdx.googlecode.com/svn/trunk/", without the quotes. If you put that into TortoiseSVN, you should perform a checkout without any problems.

Also, I still don't understand what you mean by mismatched signatures. I'm look at Effect.h and Effect.cpp. These are the signatures I'm seeing:

// cpp fileEffect^ Effect::FromFile( SlimDX::Direct3D10::Device^ device, String ^fileName, String^ profile, ShaderFlags shaderFlags, EffectFlags effectFlags, EffectPool^ pool, Include^ include )Effect^ Effect::FromFile( SlimDX::Direct3D10::Device^ device, String ^fileName, String^ profile, ShaderFlags shaderFlags, EffectFlags effectFlags, EffectPool^ pool, Include^ include, [Out] String^ %compilationErrors  )// h fileEffect^ FromFile( SlimDX::Direct3D10::Device^ device, System::String^ fileName, System::String^ profile, ShaderFlags shaderFlags, EffectFlags effectFlags, EffectPool^ pool, Include^ include );Effect^ FromFile( SlimDX::Direct3D10::Device^ device, System::String^ fileName, System::String^ profile, ShaderFlags shaderFlags, EffectFlags effectFlags, EffectPool^ pool, Include^ include, [Out] System::String^ %compilationErrors );

They seem to match to me.

##### Share on other sites
Thanks again for responding so quickly. It's taken me quite a while to check everything out. I really thought I might be on to something this round, but now it appears that things are actually worse.

First, I went back to the browse tab of the Google SlimDX code site and do not see the discrepancy between the Effect.cpp and Effect.h that I saw yesterday afternoon. I must have done something odd when browsing/searching the files and somehow got hold of some older version of the .cpp file. Sorry for the wild goose chase on that one.

Your instructions for SVN did the trick and I have successfully downloaded the source. When I first tried to load the solution, I found that it was for VS 2008. I had been working in VS 2005. This gave me an excuse to install 2008 (which I'd been meaning to do anyway). A few hours later I was finally able to open and try to build the solution. Then I found what I thought might be my real problem - that the current version of SlimDX requires the August 2008 DirectX SDK. I was still using the June 2008 DirectX SDK version. After installing the latest DirectX version, I was able to build the latest SlimDX.

Once things built, I ran the current MiniTri executable (I just right clicked on the MiniTri project, clicked Debug and then told it to start a new instance.) I'm able to step through the app and the SlimDX code now. However, with the latest version of the code, I don't even get as far as loading the effects. I'm getting an exception from D3D10.Device.CreateWithSwapChain (line 85 of Program.cs). The output created by the call is shown between the two lines below.

-----
First-chance exception at 0x765ab09e in MiniTri.exe: Microsoft C++ exception: _com_error at memory location 0x002ce51c..
First-chance exception at 0x765ab09e in MiniTri.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
A first chance exception of type 'SlimDX.Direct3D10.Direct3D10Exception' occurred in SlimDX.dll
An unhandled exception of type 'SlimDX.Direct3D10.Direct3D10Exception' occurred in SlimDX.dll

-----

I should mention that I had a device creation problem in the earlier version too. However, in that case I followed the technique Microsoft used in their Direct3D 10 tutorials - when device creation with DriverType.Hardware failed, I tried again with DriverType.Reference. That "fix" worked with the earlier SDK, but now, when I try DriverType.Reference I get an "out of memory" exception.

I also tried to go back to the "released" Direct3D 10 version of the MiniTri sample (which has quite different device creation logic) and try it with the up-to-date DirectX SDK version. It gives the same type of errors as the current version does..

Before I go any further, I'll spend some time this weekend making sure that the August 2008 versions of Microsoft's C++ Direct3D 10 tutorials run with my current configuration.