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

C# Interactive Window with internals #12450

Closed
ZeBobo5 opened this issue Jul 12, 2016 · 3 comments
Closed

C# Interactive Window with internals #12450

ZeBobo5 opened this issue Jul 12, 2016 · 3 comments

Comments

@ZeBobo5
Copy link

ZeBobo5 commented Jul 12, 2016

How could you have access to our internal class of my assembly in C# Interactive Window ?

I tried with the following assembly attribute, but I don't know which assembly to reference:
[assembly: InternalsVisibleTo("...")]

Thanks

@aelij
Copy link
Contributor

aelij commented Jul 12, 2016

The interactive window (or, rather, Roslyn's Scripting API) generates a new assembly with a different name for every submission. For example, note the different suffixes 1-1 and 1-2 with these two consecutive submissions:

> System.Reflection.Assembly.GetExecutingAssembly().FullName
"ℛ*5c81709c-d79a-42fc-83db-6e0af081c26b#1-1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
> System.Reflection.Assembly.GetExecutingAssembly().FullName
"ℛ*5c81709c-d79a-42fc-83db-6e0af081c26b#1-2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"

So currently I don't believe it's possible. For the time being, you could use ReflectionMagic as a workaround.

@tmat
Copy link
Member

tmat commented Jul 12, 2016

We do have a work item on a backlog to introduce #r! "myassembly.dll" that allows you to add a reference to an assembly in REPL and skip visibility checks at all use sites accessing internal members of that assembly.

@tmat
Copy link
Member

tmat commented Jul 12, 2016

Related: #6748

@jinujoseph jinujoseph added this to the Unknown milestone Jul 23, 2018
@ZeBobo5 ZeBobo5 closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants