Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Util.GetArray causes several runtime errors #7

Open
hozuki opened this issue Apr 5, 2016 · 0 comments
Open

Util.GetArray causes several runtime errors #7

hozuki opened this issue Apr 5, 2016 · 0 comments

Comments

@hozuki
Copy link

hozuki commented Apr 5, 2016

The function Core.Util.GetArray uses a static array to lower array allocation costs, but newer version of SlimDX (currently I'm using SlimDX 4.0.13.44) seems to expect a array of exact length needed.
For example, in LightingDemo, running this demo will throw a NullReferenceException, located at this line:

_fxPointLight.SetRawValue(new DataStream(array, false, false), array.Length);

With the help of the debugger I found that all fields of _fxPointLight became invalid. A watch on _fxPointLight shows that the change happens just after the _fxDirLight.SetRawValue call. So I canceled the static buffer and tried to create a new array of len bytes each time, and this modification worked. I suspect SlimDX neither fully checks the parameters nor handles this situation well and internal states of D3D just crash.
This problem also affects other several demos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant