-
Notifications
You must be signed in to change notification settings - Fork 48
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
Need to retain type forward information for forwarded types #373
Comments
@TianqiZhang as discussed in that other thread, the Would that be enough to properly figure out how to mark the info in that matrix? If an assembly is in the frameworks index file, then it's ✔️, but if it's only listed on the type/member |
@joelmartinez I see what you mean. @mairaw is there a special reason for It looks like we either manually move the facade assemblies to dependency folder, or we identify them when doing reflection. @joelmartinez when ECMA2Yaml generates the _moniker2assembly.json mapping, it excludes facades which doesn't have any real types defined: |
That's the drop I get from the PU. It includes facades as well. |
can we 100% guarantee that a façade assembly is defined by the fact that it only contains exported types? And if so, that mdoc would never want to include this assembly in the list of assemblies on the frameworks index file? I don't know … that seems like one of those things that is just asking to be proved wrong :P @dend, thoughts? |
@joelmartinez I'd like to request mdoc to add a flag for these facade assemblies in frameworks index file, so that downstream can have the flexibility to handle them for different requirements. Per my understanding, there are at least 3 places that used assembly info:
If mdoc can flag out the facade assemblies, it will greatly help in No.2 and No.3 scenarios. cc @mairaw @dend |
@TianqiZhang understood. I would still like to get verification that a façade assembly is defined by only containing exported types and nothing else (perhaps @terrajobst could comment?). Implementation Notes:
|
@joelmartinez here I found an article about facade assembly: https://github.com/dotnet/standard/blob/master/docs/history/evolution-of-design-time-assemblies.md I gave it more thinking during the past weeks. Marking an assembly to be "facade" in framework index file is relatively easy to implement for us, however that's a bit "coarse-grained" because it can't handle the "partial facade" case, which means an assembly can both contain forwarded types and define its own type at the same time. On the other hand, marking type forward info in <AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion forwarded="true" frameworkAlternative="netcore-2.1;netcore-2.2">4.0.0.0</AssemblyVersion>
</AssemblyInfo> This won't make the ECMAXML much bigger, because type forwarding only happens on type level, so we don't need to touch |
@TianqiZhang wouldn't it also need to tell what assembly it was forwarded to ? |
@joelmartinez oh what I meant by <AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion forwardedFrom="System.Collections" frameworkAlternative="netcore-2.1;netcore-2.2">4.0.0.0</AssemblyVersion>
</AssemblyInfo> |
Ahh! ok, yes this is much clearer as far as communicating intent :) Some implementation notes/thoughtsThe trick here from an implementation perspective is going to be that, the way the Mono.Cecil API works (and by extension, mdoc's data structures), is that resolving the type (which happens early on in the process) passes through some behind-the-scenes classes, so by the time mdoc is enumerating through that type, it only sees the actual assembly that contains the type definition (so in the example case you've got here, mdoc only sees That being said, we have a mechanism that we might be able to use. I added a |
aha, thanks for the heads up. A forward mapping seems handy. I took a brief look at the code, it seems that you already have the forwarding chain recorded in So just another example for communicating intent (😁), can we add a bunch of <Type Name="Dictionary<TKey,TValue>" FullName="System.Collections.Generic.Dictionary<TKey,TValue>">
<TypeSignature Language="C#" Value="blablabla" />
<TypeForwardingChain frameworkAlternative="netcore-2.1;netcore-2.2">
<TypeForwarding From="mscorlib" To="System.Collections"/>
</TypeForwardingChain>
</Type> |
@joelmartinez any thoughts on this? |
yeah, something like that should definitely be possible … would definitely make it clearer. |
mdoc 5.7.4.10 (in this PR #432) will add a feature that will make this enhancement infinitely easier to implement. You can see the initial implementation here: Essentially, the
This information is at the moniker/framework level. It still doesn't fully answer the questions at the member level though, so a bit more work will be necessary ... we will probably have to rethink how we track these assembly references, because a type/member might be in an assembly in one moniker, but forwarded to another in another. I'm tempted to say that we need to move this into the framework xml file, but those files are already so huge. More planning TBD |
@joelmartinez this is such great news! From the perspective of displaying the |
@TianqiZhang ahh, well that's great :D I wonder if we should get rid of assembly info at the member level entirely then? |
@joelmartinez I think it's probably doable. Once we start to mark forwarded assemblies at type level in ECMAXML, I'll start to refactor the whole assembly-moniker-uid mapping logic in ECMA2Yaml, that might be a good chance to kill the dependency on member-level assembly xml node. |
This feature will be completed in PR #452 |
This is related to #103 and #342. Now that both of them are closed, there's still one missing piece.
Take
Dictionary<TKey,TValue>
as an example, the full assembly info should include information like in below 2-dimensional matrix:I can somehow put together all information in this matrix except for the ❔. Now we are showing ❔ as ✔️ too, however it should be "forwarded".
I'm wondering if there's a good way to include this information in ECMAXML.
The text was updated successfully, but these errors were encountered: