Skip to content

CommandLineParser throws when using streamdeck-tools in .NET 8 #83

@eXpl0it3r

Description

@eXpl0it3r

When I upgraded my plugin to .NET 8, the plugin fails to start and logs the following:

Unhandled Exception: System.InvalidOperationException: Type BarRaider.SdTools.Payloads.StreamDeckOptions appears to be immutable, but no constructor found to accept values.
   at CommandLine.Core.InstanceBuilder.BuildImmutable[T](Type, Maybe`1, IEnumerable`1, IEnumerable`1, List`1)
   at CommandLine.Core.InstanceBuilder.<>c__DisplayClass1_0`1.<Build>b__5()
   at CommandLine.Core.InstanceBuilder.Build[T](Maybe`1, Func`3, IEnumerable`1, StringComparer, Boolean, CultureInfo, Boolean, Boolean, Boolean, IEnumerable`1)
   at CommandLine.Parser.ParseArguments[T](IEnumerable`1)
   at BarRaider.SdTools.SDWrapper.Run(String[], PluginActionId[], IUpdateHandler)
   at Clockify.Program.Main(String[]) in D:\a\streamdeck-clockify\streamdeck-clockify\Clockify\Program.cs:line 9

Here's the relevant code:

using BarRaider.SdTools;

namespace Clockify;

public static class Program
{
    public static void Main(string[] args)
    {
        SDWrapper.Run(args);
    }
}

It seems like some behavior with immutable types changed in .NET 8 which causes failures. When sticking to .NET 6, I'm not running into this issue.

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