I need to use BITS COM https://msdn.microsoft.com/en-us/library/windows/desktop/aa362708(v=vs.85).aspx in our .NET project. I cannot use 3rd party libraries which wrap BITS interface but frankly speaking there is not a big choice anyway. So, apparently I'm stuck with generating RCW (https://msdn.microsoft.com/en-us/library/5dxz80y2(v=vs.110).aspx) and the most conventional way of doing it is tlbimp.exe which did its work but with warnings. In the result I have one structure marked as ComConversionLoss
[ComConversionLoss]
[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]
public struct BG_AUTH_CREDENTIALS_UNION {
}
Most likely it happened because it is a union in C++ and tlbimp.exe did not know how to generate it right. The only suggestion for cases like that was to decompile generated DLL with ildasm.exe fix it and recompile again. I think technically I can do it but I would rather not if there is a better way I possibly don't know about. I, also, found tlbimp2.exe which didn't help in my case so I'm looking for a better alternative to tlbimp.exe which would be able to handle this case and ideally generate COM wrappers with IDisposable implementation for deterministic control of the COM objects lifetime but this is a separate question. First of all, I need that other tool to handle my case (C++ union types) properly. Does anybody know such a tool?