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

Latest unstable version (v0.9.12) doesn't launch #375

Open
marad opened this issue Oct 7, 2022 · 12 comments
Open

Latest unstable version (v0.9.12) doesn't launch #375

marad opened this issue Oct 7, 2022 · 12 comments

Comments

@marad
Copy link
Contributor

marad commented Oct 7, 2022

It shows this error message:

Microsoft.CodeAnalysis.Scripting.CompilationErrorException: error CS0400: Nie mo┐na odnalečŠ nazwy typu lub przestrzeni nazw äSystem.Action`1[[workspacer.IConfigContext, workspacer.Shared, Version=0.9.12.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798eö w globalnej przestrzeni nazw (czy nie brakuje odwo│ania do zestawu?)
   at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.ThrowIfAnyCompilationErrors(DiagnosticBag diagnostics, DiagnosticFormatter formatter)
   at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T](ScriptCompiler compiler, Compilation compilation, Boolean emitDebugInformation, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.GetExecutor(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunAsync(Object globals, Func`2 catchException, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunAsync(Object globals, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript.RunAsync[T](String code, ScriptOptions options, Object globals, Type globalsType, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript.EvaluateAsync[T](String code, ScriptOptions options, Object globals, Type globalsType, CancellationToken cancellationToken)
   at workspacer.ConfigHelper.DoConfig(IConfigContext context) in D:\a\workspacer\workspacer\src\workspacer\Config\ConfigHelper.cs:line 63
   at workspacer.workspacer.Start() in D:\a\workspacer\workspacer\src\workspacer\Workspacer.cs:line 53
   at workspacer.Program.Run() in D:\a\workspacer\workspacer\src\workspacer\Program.cs:line 148
   at workspacer.Program.Main(String[] args) in D:\a\workspacer\workspacer\src\workspacer\Program.cs:line 73
@Zinvoke
Copy link

Zinvoke commented Oct 9, 2022

Can you share your workspacer.config.csx file? I believe this is an issue with the configuration and not the release I have a feeling it's because of your references to the plugin dll files ensure all of the referenced file path's are correct because i'm using the latest version and it's running perfectly okay

@marad
Copy link
Contributor Author

marad commented Oct 9, 2022

@Zinvoke I'm using latest stable version and it's ok. With the unstable version I get this error.

My config is pretty simple:

#r "C:\apps\workspacer\workspacer.Shared.dll"
#r "C:\apps\workspacer\plugins\workspacer.Bar\workspacer.Bar.dll"
#r "C:\apps\workspacer\plugins\workspacer.ActionMenu\workspacer.ActionMenu.dll"
#r "C:\apps\workspacer\plugins\workspacer.FocusIndicator\workspacer.FocusIndicator.dll"
#r "C:\apps\workspacer\plugins\workspacer.TitleBar\workspacer.TitleBar.dll"
#r "C:\apps\workspacer\plugins\workspacer.Gap\workspacer.Gap.dll"

using System;
using workspacer;
using workspacer.Bar;
using workspacer.Bar.Widgets;
using workspacer.ActionMenu;
using workspacer.FocusIndicator;
using workspacer.Gap;


Action<IConfigContext> doConfig = (context) =>
{

    // Uncomment to switch update branch (or to disable updates)
    //context.Branch = Branch.None;

    context.AddBar(new BarPluginConfig() {
        BarTitle = "workspacer.Bar",
        FontSize = 14,
        FontName = "Segoe UI",
        RightWidgets = () => new IBarWidget[] { 
            new TaskWdiget(),
            new TimeWidget(1000, "HH:mm"),
            new ActiveLayoutWidget()
        }
    });
    context.AddFocusIndicator();
    var actionMenu = context.AddActionMenu();
    actionMenu.DefaultMenu.AddFreeForm("hello", (s) => Console.WriteLine(s));


    context.AddGap(
        new GapPluginConfig()
        {
            InnerGap = 10,
            OuterGap = 5,
            Delta = 5
        }
    );

    context.DefaultLayouts = () => new ILayoutEngine[] { 
        new DwindleLayoutEngine(),
        new TallLayoutEngine() 
    };


    context.WorkspaceContainer.CreateWorkspaces("1", "2", "3", "4", "5", "6", "7");
    context.WorkspaceContainer.CreateWorkspaces("Zoom", "Music", "IM");
    context.Keybinds.Subscribe(KeyModifiers.Alt, Keys.D0, () => {
        context.Workspaces.SwitchToWorkspace(9);
    });
    context.CanMinimizeWindows = true; // false by default

    context.WindowRouter.AddRoute(WindowRouter(context, WindowToDesktopMapping));
    context.WindowRouter.AddFilter(ShouldTileWindow);
    

    context.Keybinds.Subscribe(KeyModifiers.Alt, Keys.Z, () => {
        context.ToggleConsoleWindow();
    });
    context.Keybinds.Subscribe(KeyModifiers.Alt, Keys.F11, () => {
        var window = context.Workspaces.FocusedWorkspace.FocusedWindow;
        if (window.IsMaximized) {
            window.ShowNormal();
        } else {
            window.ShowMaximized();
        }
    });
    

    context.Keybinds.Unsubscribe(KeyModifiers.Alt, Keys.Enter);

};
return doConfig;


public Func<IWindow, IWorkspace> WindowRouter(
    IConfigContext context,
    Func<IWindow, string> mappings
) {
    return (window) => {
        var workspaceName = mappings(window);
        if (workspaceName == null) {
            return null;
        } else {
            return context.WorkspaceContainer[workspaceName];
        }
    };
}

public string WindowToDesktopMapping(IWindow window) {
    /**/ if (window.Title.Contains("Zoom")) return "Zoom";
    else if (window.Title.Contains("YouTube Music")) return "Music";
    else if (window.Title.Contains("WhatsApp")) return "IM";
    else if (window.Title.Contains("Messenger")) return "IM";
    else if (window.Title.Contains("MTGA")) return "5";
    else return null;
}

public Boolean ShouldTileWindow(IWindow window) {
    return !ShouldSkipWindow(window);
}

public Boolean ShouldSkipWindow(IWindow window) {
    return window.Class.Contains("SunAwtWindow") 
        || window.Title.Contains("Window Spy")
        || window.Class.Contains("GlassWndClass-GlassWindowClass");
}

public class TaskWdiget : workspacer.Bar.BarWidgetBase
{
    private int index = 0;
    private string[] msgs = {
        "hello",
        "world"
    };
    public TaskWdiget() {

    }

    public override workspacer.Bar.IBarWidgetPart[] GetParts() {
        return Parts(Part(msgs[index], partClicked: () => {
            index = (index+1) % msgs.Length;
            MarkDirty();
        }));
    }

    public override void Initialize() {
    }
}

@Zinvoke
Copy link

Zinvoke commented Oct 9, 2022

Untitled
The latest version self compiled version is working for me fine I would check your reference path's and make sure all of the dll files are present and current heres what mine look like

#r "C:\Workspacer\src\workspacer\bin\Release\net5.0-windows\win10-x64\workspacer.Shared.dll"
#r "C:\Workspacer\src\workspacer\bin\Release\net5.0-windows\win10-x64\plugins\workspacer.Bar\workspacer.Bar.dll"
#r "C:\Workspacer\src\workspacer\bin\Release\net5.0-windows\win10-x64\plugins\workspacer.ActionMenu\workspacer.ActionMenu.dll"
#r "C:\Workspacer\src\workspacer\bin\Release\net5.0-windows\win10-x64\plugins\workspacer.FocusIndicator\workspacer.FocusIndicator.dll"
#r "C:\Workspacer\src\workspacer\bin\Release\net5.0-windows\win10-x64\plugins\workspacer.TitleBar\workspacer.TitleBar.dll"
#r "C:\Workspacer\src\workspacer\bin\Release\net5.0-windows\win10-x64\plugins\workspacer.Gap\workspacer.Gap.dll"

@marad
Copy link
Contributor Author

marad commented Oct 12, 2022

DLLs are all in correct places. I don't think it's config related. Maybe it's environment related? Maybe you have something installed that I don't and the DLLs try to use that?

The error in english would be something like this:

The type or namespace name 'System.Action`1[...]' could not be found in the global namespace (are you missing an assembly reference?)

In my config I have not used any global name System.Action so I'm pretty clueless as to why it does not work. Also keep in mind that this config WORKS with previous version of Workspacer.

@josteink
Copy link
Member

josteink commented Oct 13, 2022

If you are using function-valued parameters anywhere, you are implicitly creating System.Action instances.

var x = "123"; // System.String

var y = () =>
{
   Console.WriteLine("Hey there!");
}; // System.Action

That said, I'd consider it weird if System-references are not implicit or working.

@marad
Copy link
Contributor Author

marad commented Oct 14, 2022

To me it's really surprising that it works with one version and not the other.
I'll try to fiddle a bit with my config to remove those actions and see if it has any effect.

@pranavpa8788
Copy link

@Zinvoke totally unrelated question to this issue. But, are you Windows 11? If so, what task bar and icon theme are those?

@marad
Copy link
Contributor Author

marad commented Oct 19, 2022

Okay, I've done some tests and this must be related to my build environment.

  • If I remove the config file completely, workspacer starts ok
  • If I create completely empty workspacer.config.csx then it fails with this message

I'm not C#-native so I have no idea how to even debug this further. Do you have any ideas? Are there any instructions on how to setup build environment for developing Workspacer (or any C# project for that matter :D)?

@josteink
Copy link
Member

CC: @tlsomers

Do you think this could be related to your F# changes?

@tlsomers
Copy link
Contributor

Seeing as plugins don't do anything until they're activated, it's not likely to be the case. I'm guessing it might be using a different .net SDK or runtime somehow. Will investigate later today or tomorrow

@melMass
Copy link

melMass commented Nov 5, 2022

Hi, I'm having the exact same issue on windows 10 after updating from stable to latest unstable from 3 days ago (tagged 0.9.12)

Microsoft.CodeAnalysis.Scripting.CompilationErrorException: error CS0400: The type or namespace name 'System.Action`1[[workspacer.IConfigContext, workspacer.Shared, Version=0.9.11.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' could not be found in the global namespace (are you missing an assembly reference?)
   at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.ThrowIfAnyCompilationErrors(DiagnosticBag diagnostics, DiagnosticFormatter formatter)
   at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T](ScriptCompiler compiler, Compilation compilation, Boolean emitDebugInformation, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.GetExecutor(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunAsync(Object globals, Func`2 catchException, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunAsync(Object globals, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript.RunAsync[T](String code, ScriptOptions options, Object globals, Type globalsType, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript.EvaluateAsync[T](String code, ScriptOptions options, Object globals, Type globalsType, CancellationToken cancellationToken)
   at workspacer.ConfigHelper.DoConfig(IConfigContext context) in D:\a\workspacer\workspacer\src\workspacer\Config\ConfigHelper.cs:line 70
   at workspacer.workspacer.Start() in D:\a\workspacer\workspacer\src\workspacer\Workspacer.cs:line 52
   at workspacer.Program.Run() in D:\a\workspacer\workspacer\src\workspacer\Program.cs:line 148
   at workspacer.Program.Main(String[] args) in D:\a\workspacer\workspacer\src\workspacer\Program.cs:line 73

@melMass
Copy link

melMass commented Nov 5, 2022

I found the issue!!
My scoop install was conflicting with the release msi one:

scoop uninstall workspacer

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

6 participants