Not possible to instantiate an internal endpoint interface from a signed assembly
- Dominant language
- C#
- Stars
- 1.1k
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
**Description**
RestEase has a problem when i want to instantiate a client for an internal interface from a signed assembly.
In this case it is not possible to add an `InternalsVisibleTo` attribute which only contains the assembly name (RestClient.FactoryAssemblyName) it also must contain a public key.
Unfortunately RestEase completely ignores the public key when checking the attribute (https://github.com/canton7/RestEase/blob/00dfdfba00e12811b31f8063f742af4acaf41fda/src/RestEase/Implementation/ReflectionTypeAnalyzer.cs#L105) and it requires the assembly name to be RestClient.FactoryAssemblyName, which leads to compile time error.
Instead the check should ensure that either the assembly name equals RestClient.FactoryAssemblyName or assembly name starts with RestClient.FactoryAssemblyName followed by ', PublicKey='.
This would cover all cases for sined and unsigned assemblies and for public and internal interfaces
**To Reproduce**
Create new project, add a key to automatically sign it. Add RestEase package and create a new internal inteface for an endpoing. When instantiating the interface service with RestClient you will get an error.
**Version Info**
- RestEase version: 1.6.4
- Target framework version: .Net Framework 4.6.1
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/RestEase/Implementation/ReflectionTypeAnalyzer.cs around the linked line where InternalsVisibleTo is checked, then reproduce the failure with a signed assembly and an internal endpoint interface. Done means the check accepts both the exact factory assembly name and the same name followed by a public key, while preserving support for unsigned and public interfaces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100