mono / CppSharp

Tools and libraries to glue C/C++ APIs to high-level languages
MIT License
3.15k stars 518 forks source link

Method with std::function parameter is not generated #1834

Open dcsoft4 opened 9 months ago

dcsoft4 commented 9 months ago
Brief Description

Creating a C# wrapper for this CPP class fails to generate the async_read method.

namespace foo
{
    enum class ErrorCode : int
    {
        Success = 0,
        IncompleteTransfer = 1,
        BufferTooBig = 2,
        Disconnect = 3,
    };

    /// A Buffer holds a single message to be written or being read.
    using Buffer = std::vector<uint8_t>;

    using ReadCompletionHandler = std::function<void(ErrorCode, const Buffer &)>;

    class Bar
    {
    public:
        void async_read(const ReadCompletionHandler &handler);

    private:
        Buffer _buffer;
    };
}

OS: Windows 11 22H2 CppSharp version: 1.1.5.3168

Used settings

Target: MSVC

Other settings

Stack trace or incompilable generated code

It runs without error but the Foo.cs output doesn't have the method. Full Visual Studio solution and output is in the next comment.

dcsoft4 commented 9 months ago

cppsharpissue.zip