tripix

Hi,

I am getting a weird exception throw from 4 PCs that have the XNA 1.0 redist installed. I have a development PC that is executing the game perfectly, but the other 4 PCs (Windows 2003, Vista and XP SP2 based) throw this exception:

The type initializer for 'Microsoft.Xna.Framework.Graphics.GraphicsAdapter' threw an exception.

Is anybody else having this problem

The project I am distributing is just a WindowsGame project, unaltered.



Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

Glenn Wilson

I would check to make sure that the graphics cards on the systems meet the required levels (Normally Shader levels), this is the most common problem.






Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

tripix

These PCs are using GeForce7950 and 6600GT graphics cards.



Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

Glenn Wilson

Can you post the details of the exception, You might have to add some error checking and try catch statements to catch them.






Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

Tomas Jecha

I have exactly same problem! On my computer it's working fine, but on other PC it's throwing error:

"The type initializer for "Microsoft.Xna.Framework.Graphics.GraphicAdapter" threw an exception."

Code:

Dim presentParams As New PresentationParameters

presentParams.SwapEffect = SwapEffect.Discard

Dim XNAGraphicsAdapater As Microsoft.Xna.Framework.Graphics.GraphicsAdapter = Graphics.GraphicsAdapter.Adapters.Item(0)

Device = New Graphics.GraphicsDevice(XNAGraphicsAdapater, DeviceType.Hardware, Me.Handle, CreateOptions.SoftwareVertexProcessing, presentParams)

And that PC isn't old, almost every nextgen game working on it.






Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

Peter D.

do these machines have .net 2.0 installed as well as the xna redist





Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

tripix

Peter D. wrote:
do these machines have .net 2.0 installed as well as the xna redist

All of them do.





Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

Tomas Jecha

Of course. So where's problem I don't using any complicated functions I just want to create GraphicAdapter.
Pls help someone.





Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

tripix

Exception Type:
System.TypeInitializationException

Message:
The type initializer for 'Microsoft.Xna.Framework.Graphics.GraphicsAdapter' threw an exception.

Source:
Microsoft.Xna.Framework

Stack Trace:
at Microsoft.Xna.Framework.Graphics.GraphicsAdapter.get_Adapters()
at Microsoft.Xna.Framework.GraphicsDeviceManager.CheckForAvailableSupportedHardware()
at Microsoft.Xna.Framework.GraphicsDeviceManager.ChangeDevice(Boolean forceCreate)
at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice()
at Microsoft.Xna.Framework.Game.Run()
at WindowsGame1.Program.Main(String[] args)





Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

Peter D.

Your problem is most likely related to these two lines

Dim XNAGraphicsAdapater As Microsoft.Xna.Framework.Graphics.GraphicsAdapter = Graphics.GraphicsAdapter.Adapters.Item(0)

Device = New Graphics.GraphicsDevice(XNAGraphicsAdapater, DeviceType.Hardware, Me.Handle, CreateOptions.SoftwareVertexProcessing, presentParams)

There is no guarantee that Adapters.item[0] is the adapter you need. Especially if you have an onboard graphics chip as well as a seperate pci/agp card so this may be causing the failure.

May I ask why you are creating the adapter in this way





Re: XNA Game Studio Express Exception throw by GraphicsAdaptor???

Tomas Jecha

I found finally true reason of these problems. Check this pages for solution: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1009203&SiteID=1