aelij / IgnoresAccessChecksToGenerator

Generates reference assemblies where all the internal types & members become public, and applies the IgnoresAccessChecksTo attribute
MIT License
167 stars 21 forks source link

Does not open access to private methods #5

Closed sturlath closed 3 years ago

sturlath commented 5 years ago

Hi I was trying this out on Strathweb.Samples.CSharp.NoVisibilityChecks and it works for classes but I can't get it to work with the private method Calculate().

Shouldn't it work there also?

image

aelij commented 5 years ago

AFAIK the CLR only supports calling internal members with this attribute. So the Publicize task only transforms internal to public. But you can experiment, with the code perhaps it would work with private as well.

sturlath commented 5 years ago

Thanks. I’ll look into it now that I know what the problem area is.

Somehow he manages to do it here https://www.strathweb.com/2018/10/no-internalvisibleto-no-problem-bypassing-c-visibility-rules-with-roslyn/ (evenhough I havent gotten that to work either 🙈)

TheFanatr commented 5 years ago

Doesn't work for me either. I tried a whole bunch of combinations of everything from packages to source code in the assembly, and nothing works. I think it may be possible that the CLR team decided that the ability to make everything in a third party assembly public was too dangerous to give to people. Either that or having the .NET Core 3.0 preview installed is messing with CLR in a way that disables this functionality.

aelij commented 3 years ago

Closing as it doesn't seem possible

go-live-tech commented 2 years ago

Actually calling private member does work. There's another package similar to this one, MakeTypesPublic, which works flawlessly with private members.