Skip to content

Mixing code generators doesn't work #319

Open

Description

@IsaacSherman

I have a project where I'm defining the SignalR details from a spec using Roslyn code generation. I'm making the hub interface dynamically. Unfortunately the CLI tool doesn't seem to see it- even if I use the --asm true option- I figured that would be enough to make it look at the final output. Is there something else I can do? I'd love to make this work.

Here is the code being generated - if it isn't obvious, this is the code I'm generating. (snipped for clarity and I've omitted the generated implementation)

[Hub]
public interface IAcquisitionDataHub
{
        Task<bool> ShowActive();
        Task<int[]> ShowData(int start = default, int length = default);
        Task<int> ShowGainCoarse();
        Task<double> ShowGainFine();
        Task<int> ShowHighVoltageActual();
        Task<int> ShowHighVoltageTarget();
        Task<long> ShowIntegral(int startchannel = default, int endchannel = default);
        Task<string> ShowVersion();
        Task SetGainCoarse(int gainvalue);
        Task SetGainFine(double gainvalue);
        Task SetHighVoltage(int voltage);
        Task SetRoi(int startchannel, int endchannel);
        Task EnableHighVoltage();
        Task DisableHighVoltage();
        Task Start(int segmentmask = default);
        Task Stop();
        Task Clear();
}

[Receiver]
public interface IAcquisitionDataHubReceiver
{
    Task ReceiveAcquisitionData(int[] data, int startIndex); 
    Task ReceiveOscilloscopeData(int[] data);
        Task OnSetGainCoarse(int gainvalue);
        Task OnSetGainFine(double gainvalue);
        Task OnSetHighVoltage(int voltage);
        Task OnSetRoi(int startchannel, int endchannel);
        Task OnEnableHighVoltage(string message);
        Task OnDisableHighVoltage(string message);
        Task OnStart(string message);
        Task OnStop(string message);
        Task OnClear(string message);
}

Activity

  1. IsaacSherman commented on Jan 5, 2026

    @IsaacSherman
    Author

    This is the file that got generated by dotnet tsrts --project Project.csproj --output generated --asm true:

    /* eslint-disable */
    /* tslint:disable */
    // @ts-nocheck
    import type { HubConnection, IStreamResult, Subject } from '@microsoft/signalr';
    
    
    // components
    
    export type Disposable = {
        dispose(): void;
    }
    
    export type HubProxyFactory<T> = {
        createHubProxy(connection: HubConnection): T;
    }
    
    export type ReceiverRegister<T> = {
        register(connection: HubConnection, receiver: T): Disposable;
    }
    
    type ReceiverMethod = {
        methodName: string,
        method: (...args: any[]) => void
    }
    
    class ReceiverMethodSubscription implements Disposable {
    
        public constructor(
            private connection: HubConnection,
            private receiverMethod: ReceiverMethod[]) {
        }
    
        public readonly dispose = () => {
            for (const it of this.receiverMethod) {
                this.connection.off(it.methodName, it.method);
            }
        }
    }
    
    // API
    
    export type HubProxyFactoryProvider = {
    }
    
    export const getHubProxyFactory = ((hubType: string) => {
    }) as HubProxyFactoryProvider;
    
    export type ReceiverRegisterProvider = {
    }
    
    export const getReceiverRegister = ((receiverType: string) => {
    }) as ReceiverRegisterProvider;
    
    // HubProxy
    
    
    // Receiver
    
    
  2. changed the title [-]Mixing generators doesn't work[/-] [+]Mixing code generators doesn't work[/+] on Jan 5, 2026
  3. nenoNaninu commented on Jan 14, 2026

    @nenoNaninu
    Owner

    I'm making the hub interface dynamically.

    It is impossible to support interfaces that are dynamically generated at runtime.
    hub/receiver interfaces must be defined at compile time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions