Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Merge changes from TFS - #1505

Merged
jkotas merged 1 commit into
dotnet:nmirrorfrom
dotnet-bot:from-tfs
Jul 12, 2016
Merged

jkotas merged 1 commit into
dotnet:nmirrorfrom
dotnet-bot:from-tfs

Conversation

@dotnet-bot

Copy link
Copy Markdown
Collaborator

No description provided.

When looking at a dump, I realized our code below doesn't really do anything:

return new InvalidCastException(String.Format(
  SR.InvalidCast_Com,
  comObjectDisplayName,
  interfaceDisplayName,
  interfaceType.GetInterfaceGuid().ToString("B").ToUpper(),
  errorMessage));

Because SR.InvalidCast_Com is "InvalidCast_Com" and rest of the args get lost. Switching to SR.Format fixes this since it would concat the rest of the arguments to InvalidCast_Com so the message is still useful.

I'm adding il2ilcr to broaden the awareness - it is pretty costly to have one of those bugs since you lose valuable insight (like in the dump case we lost the HRESULT and error message in the failed QI). I did a scan in System.Private.Interop and fixed all instances.

The new error message is (ignore the apparently successful message since I forgot to change the HR when I force the error path).

0:000> du 0x01b563cc+0x8
01b563d4  "InvalidCast_ComSystem.__ComObjec"
01b56414  "t, MissingMetadataType, {F5EA435"
01b56454  "E-A7DB-37E0-B506-A9B69802CDD1}, "
01b56494  "The operation completed successf"
01b564d4  "ully. (Excep_FromHResult 0x0). F"
01b56514  "or more information, visit http:"
01b56554  "//go.microsoft.com/fwlink/?LinkI"
01b56594  "d=623485"

This is apparently much more useful than "InvalidCast_Com" :)

[tfs-changeset: 1617170]
@jkotas
jkotas merged commit aaac79a into dotnet:nmirror Jul 12, 2016
@dotnet-bot
dotnet-bot deleted the from-tfs branch July 12, 2016 03:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants