I am developing in c # an application for android, and I have a try / catch block that I must review, step by step, but when I execute, it does not stop at the breakpoint. Is there any way?
private async void onSaveAsync(object sender, EventArgs e)
{
// recuperar imagen
Stream x;
byte[] buffer;
Stream reqStream;
FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create("ftp://elftp/archivo.png");
try
{
x = await signature.GetImageStreamAsync(SignatureImageFormat.Png);
// this is actually memory-stream so convertible to it
var mstream = (MemoryStream)x;
//Unfortunately above mstream is not valid until you take it as byte array
mstream = new MemoryStream(mstream.ToArray());
//long longitud = mstream.Length;
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("usuario", "password");
request.UsePassive = true;
request.UseBinary = true;
request.KeepAlive = true;
buffer = BitConverter.GetBytes(mstream.Length);
mstream.Read(buffer, 0, buffer.Length);
mstream.Close();
reqStream = request.GetRequestStream();
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Flush();
reqStream.Close();
}
catch (DirectoryNotFoundException dirEx)
{
// Let the user know that the directory did not exist.
Console.WriteLine("Directory not found: " + dirEx.Message);
}
}
The problem with this code is that the image that is recorded in the FTP is not the signaturepad image, but something like a small icon, which contains nothing. There is a problem in the recovery of the image as such, and the time to prepare it to upload it to FTP.
Solved !!! It was a variable type theme .. I had to use the typo byte.
Thanks