A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
Xamarin code Fails under release, doesnt during debug, UploadFile, gets fault
rick ruhl
61
Reputation points
Visual Studio 2022, version 17.0.0
Xcode 13.1
The following code works in debug mode, but faults on release mode when uploadfile is hit.
void CameraView_MediaCaptured(object sender, MediaCapturedEventArgs e)
{
Record.Text = "Re-Record";
// shutterButton.Text = $"{++counter}";
FileMediaSource file = e.Video.File;
string folder = FileSystem.AppDataDirectory;
string videomedia=file.ToString();
videobase64 = videomedia;
videobase64=videobase64.Replace("File: ", "");
}
async void OnSend(object sender, EventArgs e)
{
Constants.RestUrl = "https://collage.exteres.com/vwalk/procPIP.php";
WebClient client = new WebClient();
await Task.Run(() =>
{
byte[] byteResponse = client.UploadFile(Constants.RestUrl, videobase64);
string resultString = System.Text.Encoding.UTF8.GetString(byteResponse, 0, byteResponse.Length);
var result = JsonConvert.DeserializeObject(resultString);
Console.WriteLine(string.Format("Upload completed: {0}", result));
Send.Text = "Sent";
});
}
What could be causing it to fault under release mode only.
Developer technologies | .NET | Xamarin
Developer technologies | .NET | Xamarin
Sign in to answer