Skip to content

Ship a Roslyn analyzer with the package #17

Description

@Agash

Nice to have, not an immediate target.

Ship analyzers alongside the library the way EF Core, ASP.NET and the BCL do, so mistakes are caught at compile time in consumer code rather than at runtime against a live OBS.

Rules worth having

Positional construction of generated request records. This caused a real bug. SetSceneItemEnabledAsync passed sceneName positionally, and when the 5.7 protocol refresh inserted canvasUuid into the generated constructor the argument silently bound to the wrong parameter, so the scene was never sent and OBS answered with code 300. Parameter order follows the protocol definition and will shift again on the next refresh. An analyzer that requires named arguments for *RequestData constructors would have caught it at compile time, in every consumer's code as well as ours.

Typed batch references with parallel execution. BatchResults.Get refuses at runtime when a batch ran with RequestBatchExecutionType.Parallel, because OBS mislabels those results (#16). Where the execution type is a literal at the call site, that could be a squiggle instead.

Requests that are only valid inside a batch. Sleep outside a batch, or in a parallel batch, fails at runtime today.

Notes

Analyzers ship in analyzers/dotnet/cs inside the package. Each rule needs a DiagnosticId so consumers can suppress individually. Worth a code fix for the named-arguments rule, since that one is mechanical.

Activity

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