Thread for Generation Issues (To keep

Thread for Generation Issues (To keep nice and contained)
1 Reply
Curin
CurinOP2d ago
1. we are seeing in generation is the rgbyData span in MIB_OPAQUE_INFO looks like this:
public Span<byte> rgbyData
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return Anonymous.rgbyData.AsSpan(); }
}
public Span<byte> rgbyData
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return Anonymous.rgbyData.AsSpan(); }
}
Where AsSpan requires a length argument which isn't supplied TerraFX has the following:
public Span<byte> rgbyData
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return Anonymous.rgbyData.AsSpan(1);
}
}
public Span<byte> rgbyData
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return Anonymous.rgbyData.AsSpan(1);
}
}
There are a few other cases like this where a length variable does exist but isn't named clearly (NumberEntries or some such), likely leading to a similar scenario of the generator not knowing what to do. TerraFX in each of these cases has an appropriate value filled. --------------------------------------- 2.An example of a class where the IID was missing with generation:
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace Background {
MIDL_INTERFACE("80b47b17-ec8b-5653-850b-7508a01f52e7")
IBackgroundTaskBuilder6 : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE get_AllowRunningTaskInStandby(
boolean* value
) = 0;
virtual HRESULT STDMETHODCALLTYPE put_AllowRunningTaskInStandby(
boolean value
) = 0;
virtual HRESULT STDMETHODCALLTYPE Validate(
boolean* result
) = 0;
virtual HRESULT STDMETHODCALLTYPE Register(
HSTRING taskName,
ABI::Windows::ApplicationModel::Background::IBackgroundTaskRegistration** result
) = 0;
};

MIDL_CONST_ID IID& IID_IBackgroundTaskBuilder6 = __uuidof(IBackgroundTaskBuilder6);
} /* Background */
} /* ApplicationModel */
} /* Windows */
} /* ABI */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace Background {
MIDL_INTERFACE("80b47b17-ec8b-5653-850b-7508a01f52e7")
IBackgroundTaskBuilder6 : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE get_AllowRunningTaskInStandby(
boolean* value
) = 0;
virtual HRESULT STDMETHODCALLTYPE put_AllowRunningTaskInStandby(
boolean value
) = 0;
virtual HRESULT STDMETHODCALLTYPE Validate(
boolean* result
) = 0;
virtual HRESULT STDMETHODCALLTYPE Register(
HSTRING taskName,
ABI::Windows::ApplicationModel::Background::IBackgroundTaskRegistration** result
) = 0;
};

MIDL_CONST_ID IID& IID_IBackgroundTaskBuilder6 = __uuidof(IBackgroundTaskBuilder6);
} /* Background */
} /* ApplicationModel */
} /* Windows */
} /* ABI */
Out of curiosity is the MIDL_INTERFACE not something you can pull from clang? as all the IIDs I had to add had this, which does expand to struct __declspec(uuid("80b47b17-ec8b-5653-850b-7508a01f52e7")) __declspec(novtable) ------------------------------------------------------------ 3. There is a couple functions (in Windows\shared\ws2ipdef\Windows.gen.cs) which generate like this
public static void IN6_SET_ADDR_UNSPECIFIED([NativeTypeName("PIN6_ADDR")] IN6_ADDR* a)
{
NativeMemory.Fill(a->u.Byte, (uint)(sizeof(IN6_ADDR)), 0);
}
public static void IN6_SET_ADDR_UNSPECIFIED([NativeTypeName("PIN6_ADDR")] IN6_ADDR* a)
{
NativeMemory.Fill(a->u.Byte, (uint)(sizeof(IN6_ADDR)), 0);
}
Byte is _Byte_e__FixedBuffer but Fill expects a void* TerraFX has the following:
public static void IN6_SET_ADDR_UNSPECIFIED([NativeTypeName("PIN6_ADDR")] IN6_ADDR* a)
{
NativeMemory.Fill(&a->u.Byte, (uint)(sizeof(IN6_ADDR)), 0);
}
public static void IN6_SET_ADDR_UNSPECIFIED([NativeTypeName("PIN6_ADDR")] IN6_ADDR* a)
{
NativeMemory.Fill(&a->u.Byte, (uint)(sizeof(IN6_ADDR)), 0);
}
This is a valid solution for the instances in Silk as well, not sure what is happening here. ---------------------------------------------- 4. We have some ambiguous cref in generated comments
/// <inheritdoc cref = "IDWriteFontSet1.GetFilteredFonts"/>

[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(17)]
public HRESULT GetFilteredFonts(
[NativeTypeName("const DWRITE_FONT_PROPERTY *")] DWRITE_FONT_PROPERTY* properties,
[NativeTypeName("UINT32")] uint propertyCount,
BOOL selectAnyProperty,
IDWriteFontSet1* filteredFontSet
)
/// <inheritdoc cref = "IDWriteFontSet1.GetFilteredFonts"/>

[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(17)]
public HRESULT GetFilteredFonts(
[NativeTypeName("const DWRITE_FONT_PROPERTY *")] DWRITE_FONT_PROPERTY* properties,
[NativeTypeName("UINT32")] uint propertyCount,
BOOL selectAnyProperty,
IDWriteFontSet1* filteredFontSet
)
Anytime there are two overrides with the same name we get this issue
public HRESULT GetFilteredFonts(
[NativeTypeName("const DWRITE_FONT_AXIS_RANGE *")] DWRITE_FONT_AXIS_RANGE* fontAxisRanges,
[NativeTypeName("UINT32")] uint fontAxisRangeCount,
BOOL selectAnyRange,
IDWriteFontSet1* filteredFontSet
)
public HRESULT GetFilteredFonts(
[NativeTypeName("const DWRITE_FONT_AXIS_RANGE *")] DWRITE_FONT_AXIS_RANGE* fontAxisRanges,
[NativeTypeName("UINT32")] uint fontAxisRangeCount,
BOOL selectAnyRange,
IDWriteFontSet1* filteredFontSet
)

Did you find this page helpful?