Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Need help: InvalidCallException in D3D9 Managed!
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

cbx
Swordmaster

Canada
296 Posts

Posted - Dec 28 2004 :  7:55:32 PM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
OK something strange going on here, and was wondering if anyone else was having the same issues. I am using vb.net and DX9 Managed.

I was playing around with ways to simplify directx down to an aboslute minimum. What I did was create a class library. And added a bunch of modules and in those modules I added some publicly availible methods such as InitGraphics, ShutdownGraphics, EnableLighting etc etc.

Now all of the varibles like the D3D Device, and present parameters etc are module level varibles that are not visible to outside apps. They are declared friend so only the Class library can see them. Although I do provide methods for accessing those varibles indirectly through some methods, GetD3DDevice for example is one of those methods.

But it seems when I create an application that references this class library and calls the initgraphics method but then tries to get the value of a render state on that device like so ...

  
InitGraphics(Me, True) ' True means windoed mode  
msgbox(GetD3DDevice.RenderState.Lighting) ' get the Lighting renderstate property and show it  
  


I keep getting a InvalidCallException being thrown when I try to retrieve the Lighting render state!?! I get this exception when I try to access any of the render state properties.

I don't get this error when I call the EnableLighting method but I do get a InvalidCallException being thrown when I try to retrieve the value of one of the render state properties on this device!

Now here is the thing. i have also tried converting the modules in the class library into classes so that my application has to create an object in order to work with the methods. but I still get the same exception being thrown! What's up with that?

You wanna know what the really odd thing is. I have never ever had an InvalidCallException thrown before until of cource I installed the new DirectX sdk Devember 2004 a few days ago! This is what I suspect is causing me my problems.

Any thoughts on this?

VB.NET 2002 Test code
Download Attachment: dx9mtester.zip<br>38.07 KB

VB.NET 2005 aka VBExpress 2005 beta 1 test code
Download Attachment: WindowsApplication1.zip<br>57.98 KB

Created by: X
http://www.createdbyx.com/

Edited by - cbx on Dec 28 2004 8:23:49 PM

cbx
Swordmaster

Canada
296 Posts

Posted - Dec 28 2004 :  8:03:06 PM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
BTW I have also tested the fallowing code and it works just fine and as you would expect it to.

Public Class Form1  
    Dim GFX As Direct3D.Device  
  
     Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click  
        MsgBox(GFX.RenderState.Lighting)  
    End Sub
  
    Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed  
        GFX.Dispose()  
        GFX = Nothing  
    End Sub
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load  
         Me.Show()  
        Dim PP As New Direct3D.PresentParameters  
        PP.SwapEffect = Direct3D.SwapEffect.Discard  
        PP.AutoDepthStencilFormat = Direct3D.DepthFormat.D16  
        PP.EnableAutoDepthStencil = True
        PP.Windowed = True
        GFX = New Direct3D.Device(0, Direct3D.DeviceType.Hardware, Me, Direct3D.CreateFlags.SoftwareVertexProcessing, pp)  
    End Sub
  
    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint  
        GFX.Clear(Direct3D.ClearFlags.Target Or Direct3D.ClearFlags.ZBuffer, Color.Black, 1, 0)  
        GFX.BeginScene()  
        ' draw scene here  
        GFX.EndScene()  
        GFX.Present()  
    End Sub
End Class  



Created by: X
http://www.createdbyx.com/
Go to Top of Page

Lachlan87
Moderator

USA
160 Posts

Posted - Dec 29 2004 :  07:53:54 AM  Show Profile  Reply with Quote
One thing you should know. . . the .NET way of doing msgbox is:

MessageBox.Show(Blah,blah,blah)  


My next thought would be to ask if your passing the renderstate byVal, or byRef.

Maybe I'll think of something else later, too.

Lachlan

Edited by - Lachlan87 on Dec 29 2004 08:11:18 AM
Go to Top of Page

Lachlan87
Moderator

USA
160 Posts

Posted - Dec 29 2004 :  08:18:14 AM  Show Profile  Reply with Quote
Here's what you didn't want to be told. . . I downloaded your code and it works fine on my computer.

I guess you know what that means. (I only have the summer update)

Edited by - Lachlan87 on Dec 29 2004 08:18:32 AM
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Dec 29 2004 :  08:52:11 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
This is unrelated to your problem, but when I start VS 2002 I have the green X in the splash page to show that I have the directX sdk installed. However, I can't load your project file. It says I'm missing Managed.DirectX.dll. However, I have 3 of them, or at least 3 directories under Microsoft.Net/Managed DirectX/. 9.00.0900, 9.00.1126, and 9.02.3900. I have the October 2004 Update installed. However, I can't create any type of directx project. Even the VS directx wizard fails by saying that I'm missing that dll.
Go to Top of Page

Lachlan87
Moderator

USA
160 Posts

Posted - Dec 29 2004 :  09:16:35 AM  Show Profile  Reply with Quote
Yeah, it's a common problem with 2002. Add the references yourself---to both of the projects in the solution. If your like me though, VB 2002 won't like the version of the DX dll's he uses though. It'll tell you something about it not liking the version of .NET runtimes the DX dll's use. I had to open his solution with VB.NET 2003 to get it to work.

VB.NET 2002 has problems, that's for sure.
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Dec 29 2004 :  10:08:20 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
Ok, I got the program to compile when using the files in the 9.02.3900 folder. The test program works as well (except when I resize it too large I get an out of video memory error, LOL)

Go to Top of Page

cbx
Swordmaster

Canada
296 Posts

Posted - Dec 29 2004 :  5:03:16 PM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
quote:
Originally posted by Lachlan87
<br>Here's what you didn't want to be told. . . I downloaded your code and it works fine on my computer.

I guess you know what that means. (I only have the summer update)



As I suspected. Has anyone else got it working who does not have December 2004 installed?

As for eric not being able to reference the DirectX dll's you can find the files under the C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.3900 folder.

The problem with vs.net is that it will only list asselblies that are the same version it uses or lower. For example in VS.net 2003 when you add a reference it will only populate the availible references list with assemblies compiled for .NET framework 1.0 and 1.1 But vs.net 2002 will only populate the availible references list with assemblies compiled only for .NET framework 1.0.

With VBExpress 2005 beta 1 all 1.0, 1.1, and 2.0 assemblies can are visible in the list.

Unfortunatly it appears if the December 2004 dx release is causing my problems I will have to wait until the next dx release in Feburary to see if that update will fix my problem.

Created by: X
http://www.createdbyx.com/

Edited by - cbx on Dec 29 2004 5:05:08 PM
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Dec 29 2004 :  5:28:56 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
quote:
Originally posted by cbx

As I suspected. Has anyone else got it working who does not have December 2004 installed?


Read my previous post I got the program to compile and run with the Oct 2004 release. I'll download the December 2004 update to see if that causes any problems for me.
Go to Top of Page

cbx
Swordmaster

Canada
296 Posts

Posted - Dec 29 2004 :  5:30:07 PM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
Alrighty then, Just finished doing some testing and sure enough I'm convinced that it was the December 2004 instalation of directx that is causing me problems.

I changed the references for the vb.net 2002 and vb.net 2005 projects to use the dx assemblies in the v1.0.900.0 folder and presto it wored fine. So then I removed those dx references and added references to the dx files under the v9.03.91 folder IE the December 2004 release and crash boom bam a InvalidCallException exception is thrown! Using the v9.02.3900 assemblies also causes InvalidCallException to be thrown.

Heck i have even tried switching between retail and debug version of the managed assemblies but still keep getting the same InvalidCallException exception.

So how many stike outs is that now? 3, 4 maybe. The first release of managed directx that was made availible had unfinished documentation. The next release had that byref byval DrawText bug. Not to mention it did not install any previous versions of managed directx assemblies. And now it seems the December 2004 release goes a step further by throwing InvalidCallException exceptions all over the place! Ladies and gentlemen if the upcomming feburary release does not go smoothly... Tom Miller is gonna get some serious spam flooding from me demanding what the hell is going on over there in redmond.

Created by: X
http://www.createdbyx.com/

Edited by - cbx on Dec 29 2004 5:45:31 PM
Go to Top of Page

cbx
Swordmaster

Canada
296 Posts

Posted - Dec 30 2004 :  12:38:44 AM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
OK i'm about to make some choice words here. F%#KI*G Son of a beep beeping beep! COMON! MICIROSFT YOU ARE BETTER THEN THIS!

OK heres the deal, I just finished removing all trace of all versions of the managed dx assemblies from my system including the sdk. There was no managed dx on my system what so ever. Then I reinstalled only the December 2004 release of the dx sdk and tried to get my previous vb.net test projects to run and guess what,... InvalidCallException.

So having tried that I removed all trace of the dx sdk and managed assemblies again, and reinstalled the October 2004 dx sdk. And repeated my previous steps in trying to get my test app to work. !!InvalidCallException!! Again! with the same dam exception!

So then I began to repeat my previous steps of removing the dx sdk and managed assemblies and reinstalling the Summer 2004 sdk and managed assemblies. Hell ya I got the InvalidCallException exception being thrown.

It seems the only version that I can only get working on my system now is v1.0.900.0. So somthing about that December 2004 update is screwing somthing up some where and reaking havok on on my system resulting in InvalidCallException being thown every times I try to retrieve the value from the device. I will be interested to see if eroc has any problems if he decides to install the december 2004 update....

I have also since tried to install ALL of the dx sdk's at the dame time in order from the 2004 summer update thru to December 2004 update and still get the same InvalidCallException being thrown.

Something I did notice is that I installed 3 versions of the sdk but only 2 versions of the manages assemblies apear to be installed.

C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.3900 and
C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.03.91

Perhaps my InvalidCallException is a result of the sdk installation trying to install over top of a previously installed assembly? I just don't know any more..... If anyone has had related problems with the directx december 2004 sdk update please make a post so that we can get an idea if this is a isolated incedent or if we should all start a mass panic.

BTW: I have made some inquaries on other fourms asking if anyone using C# and the December 2004 sdk are also having similar problems and will let you know I hear anything more on this.

Something else rather strange in VBExpress 2005 Beta 1, when I try to add a reference to dx assemblies from a cirtian folder they get added to the references list but the added dx references are not the ones I selected to add in the first palce! See the attached video for a demonstration of what I am talking about. I need to explicitly specify a reference path to the v9.03.91 folder other wise I can't add dx assmeblies from the v9.03.91 folder they keep being adde to the project references list from the v9.02.3900 folder.

Also specifying the "Copy Local" flag to copy the dx references to my apps folder still does not help.

Download Attachment: wtfdxerr.zip<br>276.16 KB

Created by: X
http://www.createdbyx.com/

Edited by - cbx on Dec 30 2004 01:05:47 AM
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Dec 30 2004 :  01:46:33 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
I now have 4 versions of Managed Directx installed on my computer. The latest version for me is "9.03.91". It's almost 2 AM for me, so I'm going to bed. When I wake up tomorrow I'll test the program.

What exactly do I need to do to reproduce the error? Does it happen when you're trying to compile or when you run the program?
Go to Top of Page

cbx
Swordmaster

Canada
296 Posts

Posted - Dec 30 2004 :  02:55:04 AM  Show Profile  Visit cbx's Homepage  Send cbx an ICQ Message  Click to see cbx's MSN Messenger address  Send cbx a Yahoo! Message  Reply with Quote
quote:
Originally posted by Eric Coleman

I now have 4 versions of Managed Directx installed on my computer. The latest version for me is "9.03.91". It's almost 2 AM for me, so I'm going to bed. When I wake up tomorrow I'll test the program.

What exactly do I need to do to reproduce the error? Does it happen when you're trying to compile or when you run the program?



It only occours when you try to retrieve the value of a render state property or the Material property, or transform, sampler states, texture state properties, etc.

Created by: X
http://www.createdbyx.com/
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Dec 30 2004 :  09:29:16 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
Ok, so does the dx9mtester program do this automatically? All I get is a black screen when I run the program.
Go to Top of Page

Lachlan87
Moderator

USA
160 Posts

Posted - Dec 30 2004 :  10:01:29 AM  Show Profile  Reply with Quote
Click. A messagebox should pop up.
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Dec 30 2004 :  10:03:44 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
I get "False" when I click on the form. And this is with the 9.03.91 version.
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.23 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.