C
C#15mo ago
ch3rry

❔ cs-script causes WPF to throw error when creating new form/page

public class Module
{
public string? Name { get; set; }
public string? File { get; set; }
public Dictionary<string, object>? Options;
}

public class HostedModule
{
public dynamic? runtime;
public Module? module;
}

public enum AuxFuncType
{
None,
RequestsMenu
}

public class AuxFunc
{
// todo: options dictionary
public string? Name { get; set; }
public AuxFuncType Type { get; set; }
public Action<Dictionary<string, object>>? Action { get; set; }
}

public static class ModuleManager
{
static List<AuxFunc> auxFuncs = new List<AuxFunc>();
static Dictionary<string, HostedModule> modules = new Dictionary<string, HostedModule>();

public static void AddAuxFunc(AuxFunc auxFunc)
{
auxFuncs.Add(auxFunc);
}

public static void LoadModules()
{
foreach (var file in Directory.GetFiles("Scripts"))
{
var newModule = new HostedModule
{
runtime = CSScript.Evaluator
.ReferenceAssembly(Assembly.GetAssembly(typeof(Message)))
.LoadFile(file)
};

newModule.module = newModule.runtime!.module;
newModule.module.File = file;
newModule.runtime.OnModuleLoad();
modules.Add(newModule.module.Name!, newModule);
}
}
}
}
public class Module
{
public string? Name { get; set; }
public string? File { get; set; }
public Dictionary<string, object>? Options;
}

public class HostedModule
{
public dynamic? runtime;
public Module? module;
}

public enum AuxFuncType
{
None,
RequestsMenu
}

public class AuxFunc
{
// todo: options dictionary
public string? Name { get; set; }
public AuxFuncType Type { get; set; }
public Action<Dictionary<string, object>>? Action { get; set; }
}

public static class ModuleManager
{
static List<AuxFunc> auxFuncs = new List<AuxFunc>();
static Dictionary<string, HostedModule> modules = new Dictionary<string, HostedModule>();

public static void AddAuxFunc(AuxFunc auxFunc)
{
auxFuncs.Add(auxFunc);
}

public static void LoadModules()
{
foreach (var file in Directory.GetFiles("Scripts"))
{
var newModule = new HostedModule
{
runtime = CSScript.Evaluator
.ReferenceAssembly(Assembly.GetAssembly(typeof(Message)))
.LoadFile(file)
};

newModule.module = newModule.runtime!.module;
newModule.module.File = file;
newModule.runtime.OnModuleLoad();
modules.Add(newModule.module.Name!, newModule);
}
}
}
}
so i have a modular system for my c# application but i just noticed that it makes my app crash
System.Exception: 'The component 'myappname.WindowControl' does not have a resource identified by the URI '/myappname;component/windowcontrol.xaml'.'
System.Exception: 'The component 'myappname.WindowControl' does not have a resource identified by the URI '/myappname;component/windowcontrol.xaml'.'
this happens everytime i call LoadModules()... can somebody help me in this matter?
2 Replies
ch3rry
ch3rryOP15mo ago
solved: for some absolutely-not-sane reason this was happening because of the global (myappname) namespace, i changed it to something else and it's now working well
Accord
Accord15mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server