Skip to content

CS_IGNORE on constructors still generates dllimport #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jamesford42 opened this issue Apr 4, 2015 · 2 comments
Open

CS_IGNORE on constructors still generates dllimport #434

jamesford42 opened this issue Apr 4, 2015 · 2 comments

Comments

@jamesford42
Copy link

I have a class which is only allocated in C++ via a different a classes static method. So the constructor needs to be public but it contains parameters which do not exist in C#, hence I marked it with CS_IGNORE. However the dllimport lines in the C# wrapper class for that constructor (containing missing types) is still generated, even though it is never called.

@jamesford42
Copy link
Author

Note: same result if i make the constructor private.
Note: same result if i add another constructor which is public/not-ignored and takes no parameters (the other constructor still appears as an import and breaks the build with its unknown types).

@genuinelucifer
Copy link
Contributor

I tried to recreate this issue with:
https://gist.github.com/genuinelucifer/e2d636b1b021fc303f0b
.
What i guess is that there should be no generation of any internal member for a constructor marked with CS_IGNORE. That is entire:

            [SuppressUnmanagedCodeSecurity]
            [DllImport("Basic.Native.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
                EntryPoint="??0ConstructIgnoreCheck@@QEAA@AEBV0@@Z")]
            internal static extern global::System.IntPtr cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);

should not be generated.
.
Also, i see that the constructor definition is generated. But, I guess that should not be generated too. That is:

       public static implicit operator ConstructIgnoreCheck(int n)
        {
            return new ConstructIgnoreCheck(n);
        }

should not be generated.
Am i thinking correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants