question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GenAPI does not handle fixed buffers

See original GitHub issue
  • This issue is blocking
  • This issue is causing unreasonable pain

When using GenAPI on an assembly that contains fixed buffers, it will output the generated fixed buffer structures with unspeakable names, rather than fixed fields.

Given the following type:

public struct MyFixedBuffer
{
    public unsafe fixed int Buffer[64];
}

GenAPI will produce this output:

[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct MyFixedBuffer
{
    public MyFixedBuffer.<Buffer>e__FixedBuffer Buffer;
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
    [System.Runtime.CompilerServices.UnsafeValueTypeAttribute]
    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=256)]
    public partial struct <Buffer>e__FixedBuffer
    {
        public int FixedElementField;
    }
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
DaZombieKillercommented, Apr 7, 2023

Should this be transferred to dotnet/sdk since that is now where GenAPI lives? The issue appears to still exist there.

0reactions
DaZombieKillercommented, Aug 20, 2021

and that is just what we preserve, rather than ignoring the CompilerGenerated struct and reading the FixedBuffer attribute to get the underlying type and length and translate it to the actual syntax.

I should note that the [FixedBuffer] attribute doesn’t seem to be preserved in the current output, oddly. At least, it didn’t seem to be in the few cases I tested with (all of which were similar to the example in the OP.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't fetch buffer · Issue #210 · genicam/harvesters
I am using Allied Vision camera Manta_G-125B, it is GigE Vision camera. ... genapi.RuntimeException: Invalid layout of buffer attached to ...
Read more >
GenICam GenTL Standard
GenICam XML description implementation: there is no standardized implementation. The GenApi is only a reference implementation, not a ...
Read more >
Image Acquisition Interface for GenICam GenTL compliant ...
Only if the necessary information about the buffer are missing (i.e., the GenTL Producer does not support it) , the current settings are...
Read more >
Pylon::CStreamGrabberProxyT
Creates a CStreamGrabberProxyT object that is not attached to a pylon stream grabber. Use the Attach() method to attach the pylon stream grabber....
Read more >
How to handle heap allocated fixed length byte buffers?
resize() is called to allocate the required memory and then data can be memcpy ed into .data() . Personally I think std::vector shouldn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found