Pelco Developer Network (PDN)

Taking a Snapshot in Microsoft Visual Studio 2013

Have error when trying to take a snapshot with one of the cameras

Hi I had downloaded the sample codes for VideoXpertSDK (VxSDK-Samples-master) and I ran the sample code CSharpSample120 on Microsoft Visual Studio 2013
I had also ensure that the following were downloaded:
1) Microsoft .NET Framework 4.5.1
2) VideoXpert SDK 2.1 for VS2013 (VideoXpertSDK-2.1.92-51216aa3.vc12.msi_.zip)

I have no problems connecting to IP address, port, username and password, and have no problems selecting the displayed cameras and viewing the live stream. But when I try to take a snapshot a TargetInvocationException will occur.
file:///C:/Users/SCOAdmin/Pictures/Capture.PNG

I also did some debugging and come to find that it might be because the snapshot is not getting any image and is returning null. I wish to ask do you know what may be the cause of this error and is there solution for it?

[Admin Note: Edit by PelcoChris to display screenshot. Use Insert/Edit Image button above body of post and using link of uploaded attachment to display attachment in your post.]
TargetInvocationException

Thank you for your post. Sorry to hear about the issue you're seeing.

I tested out the same a bit today and I did receive an exception when trying to obtain a snapshot; though it was different type and place than yours. Nevertheless I do think that they are related and I'd like you to try out this solution that worked to correct the issue for me:

In MainForm.cs, just after line #153 add this:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;

Just before the var response = await client.SendAsync(request);. That has to do with changes in VideoXpert 2.1 that you may be encountering.

Please let me know if that does the trick to correct the problem you are seeing, or not.