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

Public COMVisible properties not visible in watch window of e.g. VBA #5752

Open
EuroEager2008 opened this issue Mar 11, 2023 · 0 comments
Open

Comments

@EuroEager2008
Copy link

EuroEager2008 commented Mar 11, 2023

Using VS2022 and .Net 7 (C#)
https://github.com/dotnet/samples/tree/main/core/extensions/COMServerDemo shows an in-proc COM server with one method, no properties. This may be registered and used late-bound from VBA by CreateObject().
I combined this one and https://github.com/dotnet/samples/tree/main/core/extensions/OutOfProcCOM to make an in-proc server with one property in addition to the single method.
Then I edited the .idl file and compiled it with midl just fine and got a typelibrary (.tlb).
Added true to a PropertyGroup in csproj for msbuild
and a in an ItemGroup to embed the typelibrary into the comhost assembly.
Finally regsvr32 on th comhost and the library can nor be referenced from VBA and used early-bound.
All is working from VBA designer/code, intellisense on the server object, method may be run, property value may be read, but if I single step and watch the server object by the Watch window in the VBA debugger and expand the graph, the property does not show up, only the "placeholder text" " as shown below.
I may write server.Pi (the property name) in the watch window and it shows correct value, but without intellisense, but it seems like this is the normal for other "normal" libraries as well.

This makes debugging the VBA code more cumbersome (and I suspect other faults may show up later perhaps).

EDIT: VB6 (sure , unsopported for "centuries", but still working) shows the exact same problems.

I tried very similar things using .Net full framework 8.1 (which handles COM much easier, dont need to make an idl file and run midl etc, all is done automagically) and it works like a charm.

Is this due to a bug or some missing implementation in my code, midl.exe, msbuild, .Net 7 or whatever?

image

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

No branches or pull requests

1 participant