Allow internal constructor if InternalsVisibleTo is used
- Dominant language
- C#
- Stars
- 9.7k
- Forks
- 538
- PR merge metrics
- No merged PRs in 30d
Description
### 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
Contributor guide
Research direction
No files, tests, or runnable reproduction are named. Start by tracing the constructor-discovery path that produces the reported error and investigate how InternalsVisibleTo affects access across assemblies. Done means an internal parameterless constructor is accepted for an authorized friend assembly, with regression coverage for the cross-assembly case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100