Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Apr 12, 2019

Summary

Proposed change(s)

  1. Last sentence of "Restrict using the dual interface option for the class interface." section should be:

    "... Such a description encourages late-bound clients to cache DispIds at compile time. ..."

    instead.

Justifications for suggestion(s):

  1. Caching at compile time seems to be an issue because run time can take place a long time (maybe even years) after compile time, at which time, the DispId values may have changed. Caching at run time doesn't seem likely to be much of an issue so long as the cache is refreshed / created / re-created every time the associated type is changed (which seems should be the case in the vast majority of situations). The tone of the writing in question, appears likely to indicate that the caching is undesirable. Because of this, and what I've written earlier in this paragraph, it seems likely that the author meant to refer to compile-time caching & not run-time caching.

  2. The original author meaning compile-time caching would make sense because the exported type library, available at compile time, contains the DispIds that are to be cached. See here to help understand that the DispIds are available in the type library (which is available at compile time).

  3. In the 'Avoid caching dispatch identifiers (DispIds)' section on the page, is written:

    "...To avoid breaking late-bound COM clients when using the class interface, apply the ClassInterfaceAttribute with the ClassInterfaceType.AutoDispatch value. This value implements a dispatch-only class interface, but omits the interface description from the type library. Without an interface description, clients are unable to cache DispIds at compile time. ..."

    This reference to caching DispIds at compile time, is quite likely what was meant to be referred to in the text I have suggested needs changing. In this reference above, inability to do such caching is suggested as being good in order to prevent '...breaking late-bound COM clients ...' My suggested change makes sense in connection with this, as with my suggestion applied, this 'goodness' assertion is re-iterated (although by inverting the language terms the second time). The second time, instead of saying not being able to do such caching is good, with the change, it is implied that being able to do such caching is possibly bad.

Fixes #11810

Proposed change(s)
*********************

1) Last sentence of "Restrict using the dual interface option for the class interface." section should be: "... Such a description encourages late-bound clients to cache DispIds at compile time. ..." instead.


Justifications for suggestion(s)
********************************

1. Caching at compile time seems to be an issue because run time can take place a long time (maybe even years) after compile time, at which time, the DispId values may have changed. Caching at run time doesn't seem likely to be much of an issue so long as the cache is refreshed / created / re-created every time the associated type is changed (which seems should be the case in the vast majority of situations). The tone of the writing in question, appears likely to indicate that the caching is undesirable. Because of this, and what I've written earlier in this paragraph, it seems likely that the author meant to refer to compile-time caching & not run-time caching.

2. The original author meaning compile-time caching would make sense because the exported type library, available at compile time, contains the DispIds that are to be cached. See 'https://docs.microsoft.com/en-us/windows/desktop/midl/id' to help understand that the DispIds are available in the type library (which is available at compile time).

3. In the 'Avoid caching dispatch identifiers (DispIds)' section on the page, is written: 
"...To avoid breaking late-bound COM clients when using the class interface, apply the ClassInterfaceAttribute with the ClassInterfaceType.AutoDispatch value. This value implements a dispatch-only class interface, but omits the interface description from the type library. Without an interface description, clients are unable to cache DispIds at compile time. ..."
This reference to caching DispIds at compile time, is quite likely what was meant to be referred to in the text I have suggested needs changing. In this reference above, inability to do such caching is suggested as being good in order to prevent '...breaking late-bound COM clients ...' My suggested change makes sense in connection with this, as with my suggestion applied, this 'goodness' assertion is re-iterated (although by inverting the language terms the second time). The second time, instead of saying not being able to do such caching is good, with the change, it is implied that being able to do such caching is bad.
@rpetrusha rpetrusha added the ✨ 1st-time docs contributor! Indicates PRs from new contributors to the docs repository label Apr 12, 2019
@rpetrusha rpetrusha assigned ghost Apr 12, 2019
@rpetrusha rpetrusha added this to the April 2019 milestone Apr 12, 2019
@rpetrusha
Copy link
Contributor

@AaronRobinsonMSFT and @jkoritzinsky, could you review this PR, please?

@rpetrusha
Copy link
Contributor

Thank you for contributing to the dotnet/docs repo, @markfern. Just a note to make contributing to the repo less labor-intensive: if you're going to immediately open a PR to address an issue, it's not necessary to open a corresponding issue.

@ghost
Copy link
Author

ghost commented Apr 12, 2019 via email

@rpetrusha
Copy link
Contributor

rpetrusha commented Apr 12, 2019

We'd intended to imply it in the contributor's guide with "Skip this step for small changes." But the implication isn't clear. I've opened #11818 to make it clearer.

@ghost
Copy link
Author

ghost commented Apr 13, 2019 via email

@rpetrusha
Copy link
Contributor

Closing and reopening to begin new build.

@rpetrusha rpetrusha closed this Apr 15, 2019
@rpetrusha rpetrusha reopened this Apr 15, 2019
Copy link
Contributor

@rpetrusha rpetrusha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @markfern, for this correction. We'll merge your PR as soon as the internal build completes successfully.

@rpetrusha rpetrusha merged commit efe34b7 into dotnet:master Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ 1st-time docs contributor! Indicates PRs from new contributors to the docs repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Caching DispIds at compile-time is potentially a problem (not at run-time)?

2 participants