Forum Xamarin.Mac


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to use Windows like filesystem action on Mac?

MatthieuDMatthieuD Member ✭✭
edited January 2019 in Xamarin.Mac


Here is my issue: I have an application using an old mono version (4.4.1) on an old ide (Xamarin 6.0.1) and some Windows internal calls such as FindNext or GetFileStats. These are InternalCall methods that I need to run my application.

I have updated everything to their last version, so I am now using Visual Studio for Mac 2017 and Mono (with their associated XamMac.dll).
When I start the application, it says that FindNext or FindFirst method is not found anymore (Missing method exception) and that my mono build is sort of broken.

So how do I replace these methods?
I need methods that give me the stats of a file (if it's hidden, etc), ones that get the next file in line in a ptr, or the first in a folder, etc.
Such as found on Windows .Net.

If anyone knows I am all ears :smile:

If I was not clear, tell me, I will try to explain the situation better.

Best Answers


  • MatthieuDMatthieuD Member ✭✭

    Here is one internal call:

    public extern static string FindFirst(string path, string pattern, out FileAttributes result_attr, out MonoIOError error, out IntPtr handle);

    I used what can be found here:

    Here is one error when I launch the program:

    Exception: System.MissingMethodException
    Message: Attempted to access a missing method.
    at (wrapper managed-to-native) System.IO.MonoIO.FindFirst(string,string,System.IO.FileAttributes&,System.IO.MonoIOError&,intptr&)

    And then I have the following errors:

    warning: cant resolve internal call to "System.IO.MonoIO::FindFirst(string,string,System.IO.FileAttributes&,System.IO.MonoIOError&,intptr&)" (tested without signature also)
    Your mono runtime and class libraries are out of sync.

    Maybe the simple solution is to use the new IO methods, but I don't know if there are any. Could not find them in the doc.
    To be noted that this program is years old and at the time mono was not advanced enough and didn't have IO methods, so we used this solution.

  • MatthieuDMatthieuD Member ✭✭


    I think this is what I am looking for. Not sure though.
    I don't really remember but I think years (4-6 years) ago, we could not use these methods. So now the engine runs with the old InternalCall methods which then worked properly. Maybe I can make it work with these ones.

    I will keep you updated if it does what I want. Thanks for your answer :smile:

  • MatthieuDMatthieuD Member ✭✭
    edited February 2019

    @ChrisHamons said:
    Yeah, MethodImplOptions.InternalCall means you are invoke an internal method inside mono, which is subject to change. In the many versions since 4.4, they've apparently changed the implementation.

    What are you trying to accomplish? You may just need to use and enumerate through them looking for whatever pattern you previous wanted.

    I recoded the engine to use the .net enumeration methods and it seems to work. Thank you for your answer :)

Sign In or Register to comment.