Menu

#533 Does not support Direct3D calls

open
nobody
framework (182)
5
2014-09-17
2006-09-14
Peter Wu
No

If I add Direct3D calls in the test, it will fail with
Loader Lock:

Managed Debugging Assistant 'LoaderLock' has detected
a problem in 'C:\Program Files\TestDriven.NET 2.0
\ProcessInvocation.exe'.
Additional Information:
DLL 'C:\WINDOWS\assembly\GAC\Microsoft.DirectX.Direct3D
\1.0.2902.0__31bf3856ad364e35
\Microsoft.DirectX.Direct3D.dll' is attempting managed
execution inside OS Loader lock. Do not attempt to run
managed code inside a DllMain or image initialization
function since doing so can cause the application to
hang.

Sample code:
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
using System.Threading;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using System.Windows.Forms;

[TestFixture]
[Category("Basic")]
public class TestPerformance_Direct3D
{
#region Basic Tests

[Test]
public void InitDevice()
{
// initialize direct3d device
Caps caps = Manager.GetDeviceCaps
(Manager.Adapters.Default.Adapter,
DeviceType.Hardware);
CreateFlags flags;
if
(caps.DeviceCaps.SupportsHardwareTransformAndLight)
flags =
CreateFlags.HardwareVertexProcessing;
else
flags =
CreateFlags.SoftwareVertexProcessing;
PresentParameters d3dParameters = new
PresentParameters();
d3dParameters.BackBufferFormat =
Format.Unknown;
d3dParameters.Windowed = true;
d3dParameters.SwapEffect =
SwapEffect.Discard;
d3dParameters.EnableAutoDepthStencil =
true;
d3dParameters.AutoDepthStencilFormat =
DepthFormat.D16;
d3dParameters.PresentationInterval =
PresentInterval.Immediate;
UserControl control = new UserControl();
Device d3dDevice = new Device(0,
DeviceType.Hardware, control, flags, d3dParameters);
}

#endregion
}

}

Discussion

  • Charlie Poole

    Charlie Poole - 2006-09-14

    Logged In: YES
    user_id=586918

    Have you tried making your tests run in an STA?

     

Log in to post a comment.

MongoDB Logo MongoDB