Fixed Session::queryInterface not returning OK when querying for IUnknown/ISlangUnknown #5978
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I have been trying to use the Slang Compilation API in C# by interfacing with the COM-lite API.
I've been able to call the API functions by directly interfacing with the vtable in unsafe C#, but for my own sanity, I was trying to use the source generated ComWrappers API introduced in .NET 8 to handle everything for me. However, I kept running into a low-level runtime error when it tries to create a wrapper object for the Slang
IGlobalSession
object.After a little digging, I found the issue. The .NET runtime is checking if the Slang
IGlobalSession
implementsIUnknown
by callingQueryInterface
.IGlobalSession
implementsISlangUnknown
, which shares the same IID asIUnknown
, so it should work, right?Well, it would if it weren't for this small error in the code:
slang/source/slang/slang.cpp
Line 611 in f3b916e
That
&&
is almost certainly supposed to be||
.I've built with this change and confirmed it fixes the runtime error and allows me to use Slang in C#.