Skip to content

[BUG] DAQmx enum value prefixes don't match the enum names #1245

Description

@bkeryan

Bug Report

The DAQmx attribute id enums look like this:

enum TimingDoubleAttribute {
  TIMING_DOUBLE_ATTRIBUTE_UNSPECIFIED = 0;
  TIMING_ATTRIBUTE_SAMP_CLK_TIMEBASE_RATE = 4867;
  TIMING_ATTRIBUTE_REF_CLK_RATE = 4885;
  TIMING_ATTRIBUTE_DELAY_FROM_SAMP_CLK_DELAY = 4887;
  TIMING_ATTRIBUTE_SAMP_CLK_RATE = 4932;
  TIMING_ATTRIBUTE_MASTER_TIMEBASE_RATE = 5269;
  ...
}

In C#, protoc removes enum value prefixes when they match the enum name, but it does not remove these prefixes because they don't match the enum name:

  internal enum TimingDoubleAttribute {
    [pbr::OriginalName("TIMING_DOUBLE_ATTRIBUTE_UNSPECIFIED")] Unspecified = 0,
    [pbr::OriginalName("TIMING_ATTRIBUTE_SAMP_CLK_TIMEBASE_RATE")] TimingAttributeSampClkTimebaseRate = 4867,
    [pbr::OriginalName("TIMING_ATTRIBUTE_REF_CLK_RATE")] TimingAttributeRefClkRate = 4885,
    [pbr::OriginalName("TIMING_ATTRIBUTE_DELAY_FROM_SAMP_CLK_DELAY")] TimingAttributeDelayFromSampClkDelay = 4887,
    [pbr::OriginalName("TIMING_ATTRIBUTE_SAMP_CLK_RATE")] TimingAttributeSampClkRate = 4932,
    [pbr::OriginalName("TIMING_ATTRIBUTE_MASTER_TIMEBASE_RATE")] TimingAttributeMasterTimebaseRate = 5269,
    ...

As a result, you must write TimingDoubleAttribute.TimingAttributeSampClkRate instead of TimingDoubleAttribute.SampClkRate.

Repro or Code Sample

Build Tests.IFDAQmxHardware in ASW and look at its codegen.

Expected Behavior

protoc removes prefix from enum value names.

Current Behavior

protoc preserves prefix in enum value names.

Possible Solution

Rename the enum values, but this would break compatibility.

Workaround

For projects that also depend on the DAQmx driver DLLs, you can use the DAQmx driver's enums instead of the nidaqmx.proto enums. Cast to int and use the "raw" oneofs.

Context

Writing automated tests that use NI gRPC Device Server.

Your Environment

  • Operating system and version: Windows 11
  • All NI driver versions: NI-DAQmx 2026 Q2
  • grpc-device version: 2.14.0

AB#3799891

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions