Skip to content
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

Add support for 'internal' types in custom method discovery? #229

Closed
julealgon opened this issue Aug 7, 2020 · 1 comment · Fixed by #363
Closed

Add support for 'internal' types in custom method discovery? #229

julealgon opened this issue Aug 7, 2020 · 1 comment · Fixed by #363

Comments

@julealgon
Copy link

As part of serilog/serilog-sinks-map#22, I ended up creating a custom extension method for my particular case, then configuring my appsettings to use it, adding the Using node in the json pointing to my assembly.

However, it only seems to work when the method is exposed in a public class. Trying to change it to internal and adding a InternalsVisibleTo attribute in my project targeting Serilog.Settings.Configuration didn't work at all: my method was just ignored.

I'd prefer keeping my method internal as I don't want anyone else from outside calling it (it is specific to this particular project).

Can this scenario be supported?

@nCubed
Copy link

nCubed commented Sep 2, 2020

Have you tried exposing the assembly to the Serilog assembly?

[assembly: InternalsVisibleTo("Serilog")]
// may also need to expose to configuration as well
[assembly: InternalsVisibleTo("Serilog.Settings.Configuration")]

HTH's

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

Successfully merging a pull request may close this issue.

2 participants