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

[C#] - Invalid generated code for string field. #955

Closed
leandrogomes777 opened this issue Sep 19, 2023 · 5 comments
Closed

[C#] - Invalid generated code for string field. #955

leandrogomes777 opened this issue Sep 19, 2023 · 5 comments

Comments

@leandrogomes777
Copy link

Hi guys,

I'm using the SbeTools (I've tried the one in the nuget package and with the latest version here in git), but the generated code is invalid with the template i'm running. The DirectBuffer class don't have the signature method for the generated code (Uint8Put).

The code generated below:

public void SetDeskID(string value)
{
    var encoding = DeskIDResolvedCharacterEncoding;
    const int sizeOfLengthField = 1;
    int limit = _parentMessage.Limit;
    int byteCount = _buffer.SetBytesFromString(encoding, value, limit + sizeOfLengthField);
    _parentMessage.Limit = limit + sizeOfLengthField + byteCount;
    _buffer.Uint8Put(limit, (ushort)byteCount);
}

The DirectBuffer code:

public unsafe void Uint8Put(int index, byte value)
{
    _pBuffer[index] = value;
}

Could you guys check?

Thanks.

@tmontgomery
Copy link
Contributor

@JPWatson, what are your thoughts?

@IanCastro
Copy link

I have the same problem.
Looking the code, I found this line 'indent + INDENT + "_buffer.%3$sPut%4$s(limit, (ushort)byteCount);\n" +' on https://github.com/real-logic/simple-binary-encoding/blob/master/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/csharp/CSharpGenerator.java
line 516
but when '%3$sPut%4$s' == Uint8Put this need change to: 'indent + INDENT + "_buffer.%3$sPut%4$s(limit, (byte)byteCount);\n" +'

@mjpt777
Copy link
Contributor

mjpt777 commented Oct 2, 2023

@ZachBray Can you look at this?

@ZachBray
Copy link
Contributor

ZachBray commented Oct 7, 2023

I came across this a few weeks back as well. It is already fixed in #948:
image

ZachBray added a commit to ZachBray/simple-binary-encoding that referenced this issue Oct 13, 2023
We now explore more of the "schema space", as we generate lengths of
different encodings.

It surfaces an issue, reported in real-logic#955, which was fixed in another
outstanding PR's commit: 3885a63.
ZachBray added a commit to ZachBray/simple-binary-encoding that referenced this issue Oct 18, 2023
We now explore more of the "schema space", as we generate lengths of
different encodings.

It surfaces an issue, reported in real-logic#955, which was fixed in another
outstanding PR's commit: 3885a63.
ZachBray added a commit to ZachBray/simple-binary-encoding that referenced this issue Oct 19, 2023
We now explore more of the "schema space", as we generate lengths of
different encodings.

It surfaces an issue, reported in real-logic#955, which was fixed in another
outstanding PR's commit: 3885a63.
ZachBray added a commit that referenced this issue Nov 11, 2023
We now explore more of the "schema space", as we generate lengths of
different encodings.

It surfaces an issue, reported in #955, which was fixed in another
outstanding PR's commit: 3885a63.
ZachBray added a commit that referenced this issue Nov 11, 2023
We now explore more of the "schema space", as we generate lengths of
different encodings.

It surfaces an issue, reported in #955, which was fixed in another
outstanding PR's commit: 3885a63.
@ZachBray
Copy link
Contributor

ZachBray commented Dec 6, 2023

Closing. The fix is merged and part of 1.30.0.

@ZachBray ZachBray closed this as completed Dec 6, 2023
ZachBray added a commit to ZachBray/simple-binary-encoding that referenced this issue May 1, 2024
We now explore more of the "schema space", as we generate lengths of
different encodings.

It surfaces an issue, reported in real-logic#955, which was fixed in another
outstanding PR's commit: 3885a63.
ZachBray added a commit to ZachBray/simple-binary-encoding that referenced this issue May 15, 2024
We now explore more of the "schema space", as we generate lengths of
different encodings.

It surfaces an issue, reported in real-logic#955, which was fixed in another
outstanding PR's commit: 3885a63.
ZachBray added a commit to ZachBray/simple-binary-encoding that referenced this issue Jun 25, 2024
We now explore more of the "schema space", as we generate lengths of
different encodings.

It surfaces an issue, reported in real-logic#955, which was fixed in another
outstanding PR's commit: 3885a63.
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

5 participants