tareqimbasher / NetPad

A cross-platform C# editor and playground.
MIT License
1.12k stars 60 forks source link

Feature Request: Use fixed assembly name when executing NetPad query. #157

Closed filzrev closed 5 months ago

filzrev commented 6 months ago

Currently NetPad creates different assembly name each time a query is executed.

Test query

Assembly.GetExecutingAssembly().FullName.Dump();
Assembly.GetExecutingAssembly().CodeBase.Dump();

Output

`NetPad_CompiledAssembly_Script 1_b2b3d5aa-ffb7-4a2e-b122-55f0add3514a, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
`file:///C:/Users/admin/AppData/Local/Temp/NetPad/Processes/371cbddd-91b1-4c40-9943-70abbe1f6d60/Script_1.dll`

If it can use fixed assembly name (e.g. NetPadQuery) It can access internal types of external DLLs. (If external DLL using InternalsVisibleToAttribute).

LINQPad supports this feature with [InternalsVisibleTo("LINQPadQuery")]

tareqimbasher commented 5 months ago

Sure, good idea. Will go out with next release!

tareqimbasher commented 5 months ago

PR merged. Similar to LINQPad, you'll be able to use:

[InternalsVisibleTo("NetPadScript")]