bchavez / Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Other
8.66k stars 495 forks source link

Allow internal constructor if InternalsVisibleTo is used #553

Open giammin opened 2 months ago

giammin commented 2 months ago

Description

I'm tryng ro fake a class from an external assemly. That class has only an internal parameterless constructor and the project has the attribute InternalsVisibleTo correctly set. I can call it from the test project, but if I try to generate a fake for that class I receive this error:

No parameterless constructor defined for type

I understand the logic behind not allowing private constructor but an internal constructor of an InternalsVisibleTo assembly should be allowed

LINQPad Code Example

i cant create a linq pad example because the problem is over 2 different projects/assembly

What alternatives have you considered?

I could set the constructor public but this is not an option for some of those classes

Could you help with a pull-request?

No