Closed ghost closed 6 years ago
The analyzer's code fix provider can be a bit sketchy, I'm afraid. And writing it by hand can be very tedious to get right. It looks like you've already put forward a good effort. If you share the branch you're working on, I will try to take a look.
Thanks for contributing!
Thanks for the offer to help Andrew - I appreciate it!
I was able to solve it with a little more trial and error. The key, in my example, turned out to be the addition of the names of formal parameters. For e.g., static PInvoke.Foo(System.IntPtr pVoid) -> PInvoke.HResult
works, but staticPInvoke.Foo(IntPtr) -> PInvoke.HResult
doesn't. When I think about it, this makes a lot of sense given that named arguments require argument names exposed by libraries to remain reliably stable.
I've started a pull request for your consideration.
Great. Thanks for getting back to us.
I'm working on adding a few PInvokes from Ole32, and having trouble updating PublicApi.Unshipped.txt. Running the analyzer correctly gives warning RS0016, but the analyzer doesn't offer any hints for an automatic code fix. When I try to manually edit publicapi.unshipped.txt, it helps partially.
I'm using VS2017 v15.4.1.
PublicApi.Unshipped.txt has the following entries:
Upon building, I see the following warnings:
I'd appreciate any hints on how to get these right. The relevant declarations in Ole32.cs look like this: