dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.7k stars 4.59k forks source link

Cross Platform symbols from ref-emit apis #4535

Open KevinRansom opened 8 years ago

KevinRansom commented 8 years ago

Hi Guys,

when can we expect cross platform support PDB's from REF emit. The F# compiler relies on ref-emit for Quotations and TypeProviders. We aim to have cross platform compilation and debugging working for F# by the end of the year, it would be great if we can debug quotations and TP generated types too.

Thanks

Kevin

jkotas commented 8 years ago

The plan has been to use a new portable debug info format for cross-plat. Talk to @tmat about the best way to move F# compiler over to it.

There are no plans to bring the Windows managed .pdbs cross-plat. Also, Reflection.Emit is limited for in-memory only in .NET Core. There are no plans to extend it to produce files on disk.

tmat commented 8 years ago

@jkotas I believe the question is rather whether in-memory assemblies emitted by Ref.Emit are debuggable on CoreCLR on Linux/Mac.

tmat commented 8 years ago

@KevinRansom Does F# save the Ref.Emit'd assemblies to disk for later loading?

jkotas commented 8 years ago

assemblies emitted by Ref.Emit are debuggable on CoreCLR on Linux/Mac

I do not think it is limited to Linux/Mac - the .NET Core Ref.Emit surface does not include the APIs to produce symbols, across platforms. The story for debuggable dynamically emitted assemblies in .NET Core has been to use AssemblyLoadContext.LoadFromStream(System.IO.Stream assembly, System.IO.Stream assemblySymbols).

tmat commented 8 years ago

Oh, I see. So there is no way how to emit debuggable dynamic assembly thru Reflection.Emit? Looking at System.Reflection.Emit contract I don't even see Save - so assuming there is no way how to save an Ref.Emit'd assembly to disk/byte[]. So how can I use LoadFromStream?

jkotas commented 8 years ago

how can I use LoadFromStream?

Do not use System.Reflection.Emit...

tmat commented 8 years ago

@KevinRansom Why does F# use Reflection.Emit?

dsyme commented 3 years ago

See also https://github.com/dotnet/runtime/issues/28206 and https://github.com/dotnet/runtime/issues/18703