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

System.AccessViolationException in .NET wrapper when getting the distance of a point #4877

Closed
morcibacsi opened this issue Sep 17, 2019 · 5 comments

Comments

@morcibacsi
Copy link

morcibacsi commented Sep 17, 2019

Required Info
Camera Model SR305
Firmware Version 3.27.3.0
Operating System & Version Win 10 Pro 1903
Kernel Version (Linux Only)
Platform PC
SDK Version 2.28.0.1085
Language C#
Segment Object detection

Issue Description

I am using the .NET wrapper and EmguCV to detect objects and their real world size. Sometimes I fail to detect the coordinates of the object properly. When this happens I pass invalid coordinates to the GetDistance(x, y) method of the DepthFrame class and the method raises a System.AccessViolationException. Of course I can avoid this with additional checks (like in the screenshot below), however maybe it would be nice if the method would fail in a more developer-friendly way (like a custom exception or a return value which indicates the error).

getDistance

@ev-mp
Copy link
Collaborator

ev-mp commented Sep 18, 2019

@morcibacsi , according to the attached screenshot you're passing a negative y as pixel coordinate to the function, which is out of the [0-height] range
image

@ev-mp ev-mp added the .NET label Sep 18, 2019
@morcibacsi
Copy link
Author

@ev-mp I am fully aware of that. As you can see on the screenshot, I have the necessary checks (it is just commented out) to avoid the Exception. My point was that the AccessViolationException is not the best to throw from the SDK. An ArgumentOutOfRangeException would be more appropriate.

@ev-mp
Copy link
Collaborator

ev-mp commented Sep 18, 2019

@morcibacsi , I agree that the input validation should be performed by SDK to improve the users' experience.
This will be fixed in the next releases

@RealSenseCustomerSupport
Copy link
Collaborator


Hi @morcibacsi, Do you have further questions on this? Can we close it?
Thanks,

@morcibacsi
Copy link
Author

@RealSenseCustomerSupport Can be closed. Thanks for the fix.

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

No branches or pull requests

3 participants