-
Notifications
You must be signed in to change notification settings - Fork 425
Conversation
What does it mean for a runtime to support portable PDBs? I'm worried that IL2CPP might not support this now, so I'd like more details about what is required. |
I don't think this has runtime impact |
From the coreclr perspective we needed to plumb in support to be able to read portable pdbs for diagnostics purposes to get stack traces. We actually do this in a light-up fashion and call into System.Reflection.Metadata, see dotnet/corefx#8670. @jaredpar what kind of decisions does the compiler make if this feature is present? |
By convention, by adding this type we sign up all current (ad future) runtimes to supports portable PDBs. In that sense it has runtime impact. @jaredpar, could answer @weshaggard question? Are you blocking emitting portable PDBs if the reference assemblies don't contain this field? joshpeterson
Have you had a chance looking into this? |
Yes, at the moment IL2CPP does not support portable PDBs in the runtime (we do for managed code debugging via VSTU though). I think we are fine with returning |
Unfortunately the presence of this field indicates that a runtime does have support for portable PDBs. If you guys can't support that, I'm inclined to not take this API then. How are you guys using this particular field? |
Could we do something like |
How do you define that runtime supports portable PDBs (or any PDBs), for full AOT runtime like Unity IL2CPP? I think this feature does not really make sense in full AOT runtimes like Unity IL2CPP. |
Is that not the case? |
We do consume portable PDBs during the AOT process, and can use portable PDBs when producing information for the managed debugger. But I am not sure that is what purpose this API serves. |
This API is meant to be used by dynamically generated code - see https://github.com/dotnet/corefx/issues/19788 for justification. If you are running Roslyn inside your process for scripting, generate code that you immediately load and want to work well on old runtimes that do not support Portable PDBs, you can use this API to tell whether to generate Portable PDBs or not. If the runtime does not support dynamic loading or reflection emit, |
Let's step back. The
The means code like So if we don't believe all runtimes will support portable PDBs, we should not add the field to the standard. We should still add the |
It seems like we should never add a field to the standard, if it implies all .NET Standard compatible runtimes would be required to support those features? To me, this is distinct from the current contract of exposing APIs which may or may not be implemented. In this specific case, it is unclear to me which APIs involving portable pdbs are expected to work and under what conditions if the field is present. |
Depends. For example, we decided that all runtimes must support generics now. I suspect other features (e.g. default implementations of interfaces) will be in the same camp.
Correct. The point of this type is to allow the compiler to guard against runtime failures due to use of unsupported features. Developers can guard against APIs that throw
If the field is present, it would mean that the runtime would load a PDB in portable format and use the information for debugging or when rending line number information in the exception. If the field is missing, it means a compliant runtime may or may not support this scenario. |
I think there should be runtime/CLR standards like current dotnet(BCL) standards instead of runtime feature detection. And then different language features and BCL standards should be defined on top of a certain CLR standard. Quoting myself from another discussion #682 (comment) -
|
How would a library express what the minimum requirement would be? Currently, the managed compilers don't even know the target framework -- they just get passed a bunch of assemblies and the source you want to compile against it. It seems logical to me to model runtime features as APIs because it allows us to track it like any other feature in .NET Standard. Also, runtimes are currently not something you can model as concentric circles. You could argue that they should but AOT and JIT cannot be expressed as subset/supersets. |
@jkotas any thoughts on this? Would love to get this approved by you :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuntimeFeature.IsSupported
is useful.
The usefulness of RuntimeFeature.PortablePdb
run its course, and it is not very useful anymore since all runtimes that support RuntimeFeature API do support Portable PDBs as well. However, I think it does not hurt to add it for completeness and parity with .NET Core.
Sweet. Given your comment and @joncham comments above
It seems we can at least leave the field in as well for consistency. |
dacf39a
to
4219078
Compare
This adds the
RuntimeFeature
class which enables compilers to statically discover which features the runtime is guaranteed to support. The compiler checks for individual features by looking for the presence of a static field by a well-known name. By convention, these fields are of type string.Please note that for .NET Standard this means that adding a field to this type requires all implementers to provide this feature in their runtimes. The only feature we currently have is portable PDBs, which (AFAIK) all runtimes already support.
@dotnet/nsboard