-
Notifications
You must be signed in to change notification settings - Fork 822
InternalsVisibleTo + internal module + inline function error message could be improved #7110
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
Comments
This is correct - InternalsVisibleTo doesn't allow inlining across assembly boundaries and if you try to use both of these you will get the above errors. So this is by design. |
I think that the error message could be improved. Let's consider the first one:
I can't see which "internal or private function" do Maybe we could change the text so it's more clear?
The second message looks okay if you don't read the "perhaps" part, and the warning is probably okay, too. |
The private/internal thing is We could indeed add a compilation error for that specific case (direct access to an internal Note we could really choose to keep the "internal" inlining information in the assembly whenever there is an IVT just in case the |
Okay, I understand that |
Yes, absolutely, the error message is rotten |
Tagging as a feature improvement |
Ran into this today and this today and spent 30 min trying to figure out what the issue was. Had to come here to the repo, search for the specific error message, sift through these issues just to figure out exactly what was going wrong. Not user friendly at all imo. |
Repro steps
LibProject
andTestProject
, whereTestProject
referencesLibProject
LibProject
, write the following code:TestProject
, write the following code:The repro solution is attached: ReproTestProject.zip
Expected behavior
I think that the code should compile successfully. But even if it isn't, then the compiler should print a sensible error message.
Actual behavior
The code doesn't compile and the compiler provides rather cryptic messages:
Known workarounds
Well, don't use inline functions within internal modules with the
InternalsVisibleTo
attribute :)Related information
Reproduced using .NET Core SDK:
The text was updated successfully, but these errors were encountered: