1

I've been porting a windows app to MacOS using Xamarin.Mac and so far it's been going very well. I finished the initial version and built a release version, then tried to run it outside of Visual Studio, and it crashes. The very same build does not crash if launched through Visual Studio (even with "Run without debugging"). Also, if I run the executible directly using Terminal it also works perfectly fine.

Using MacOS Mojave 10.14 / Xamarin.Mac 5.2

My best guess is it has something to do with this code:

        let ffmpeg = new Process ()
        ffmpeg.StartInfo.FileName <- "ffmpeg"
        ffmpeg.StartInfo.Arguments <- arguments
        ffmpeg.StartInfo.CreateNoWindow <- true
        ffmpeg.StartInfo.RedirectStandardOutput <- true
        ffmpeg.StartInfo.UseShellExecute <- false
        ffmpeg.StartInfo.RedirectStandardError <- true
        ffmpeg.Start() |> ignore

ffmpeg is in my PATH and if it was an issue with that, should it not be crashing when ran through VS/Terminal?

The other possibility I've thought of is it has something to do with stdout not being available somehow when the app is ran normally?

The app starts up fine, it's only when I click the button that calls the code above that it crashes.

Any thoughts on what this might be and how to fix it? Any help would be greatly appreciated!

  • Your "user" shell-based path (bash, zsh, etc...) is not included in your app|system path (it is in separate process and not your user's shell process as running from the terminal|iterm2 would). If your ffmpeg's path was covered in a /etc/paths.d/xxxxx reference you would be fine. Otherwise you would need to supply the full path+filename as your process's filename. – SushiHangover Apr 15 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.