Skip to content
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

Cache contains wrong information about COM interop after changes in the COM interfaces #73191

Open
magol opened this issue Apr 23, 2024 · 5 comments

Comments

@magol
Copy link

magol commented Apr 23, 2024

Version Used: Visual studio 2022

Steps to Reproduce:

  1. Create a COM object in C++ using MFC/ATL
  2. Create an interop DLL using tlbimp
  3. Use the interop DLL in a C# project
  4. Make changes in the IDL file for the COM object (eg remove a function)

Expected Behavior:
After that I have rebuilt the C++ code, the interop dll and the C# code, I expect that the C# code should work.

Actual Behavior:
When I call a COM function located after the removed function, it calls the wrong function.

The only way to get the code to work was to remove %LOCALAPPDATA%\Microsoft\VisualStudio\Roslyn\Cache

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 23, 2024
@CyrusNajmabadi
Copy link
Member

The only way to get the code to work was to remove %LOCALAPPDATA%\Microsoft\VisualStudio\Roslyn\Cache

The only information stored in that cache relates to indices used for "navigate to", "find references", "add import" and "as nuget package". Nothing in there affects the compiler at all.

@magol
Copy link
Author

magol commented Apr 23, 2024

That's weird.
I noticed that COM functions returned strange data. And when I stepped in the code with F11, I ended up in the wrong C++ functions. Been troubleshooting this for weeks. But as soon as I deleted the cache directory it started working. There is no information in the cache that it uses to find index in the vtable for COM?

@CyrusNajmabadi
Copy link
Member

There is no information in the cache that it uses to find index in the vtable for COM?

Correct. The cache is purely for a handful of ide features. It has no impact on the compiler whatsoever.

@genlu genlu added Area-Compilers Bug and removed Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 30, 2024
@genlu
Copy link
Member

genlu commented Apr 30, 2024

@jaredpar The behavior from compiled code seems to be a compiler issue (despite the observation from @magol around removing IDE cache)

@jaredpar
Copy link
Member

Do you have a standalone repro that we could look at?

despite the observation from @magol around removing IDE cache

Wonder if there is an underlying rebuild / up to date issue here that removing the IDE cache subtly works around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants