oleg-shilo / cs-script

C# scripting platform
http://www.cs-script.net
MIT License
1.57k stars 234 forks source link

.NET 6.0.3 Issues #287

Closed PockyBum522 closed 2 years ago

PockyBum522 commented 2 years ago

I'm getting the following error, this is using the below .NET versions (latest) and the latest cs-script release (4.4.2.0)

image

I don't think this is an issue with cs-script, I think it's related to this: https://github.com/dotnet/wpf/issues/6109

Is there any good alternate way of running cs-script that can get around this? Or will I need to uninstall the current SDK and install an older version?

If needed, my (simple) script utilizing WPF is here, just in case I'm doing something stupid in my code and it's not that WPF issue: Desktop.zip

oleg-shilo commented 2 years ago

Not sure what is happening but your sample works just fine for me.

image

Make sure you have enabled WPF support with css -wpf:1 or css -wpf:disable

PockyBum522 commented 2 years ago

It's likely that I didn't realize I needed to turn wpf on. I'll test that. Thanks!

PockyBum522 commented 2 years ago

That was indeed it. Thank you! I look forward to using this.

oleg-shilo commented 2 years ago

It was very tempting to enable WPF on windows by default but it is a very intrusive change as every script will be converted in the desktop app. So I have put an analyser in the script execution failure handler. It detects possible WPF failure and advises to enable WPF with css -wpf:enable. IE:

image

The problem was that your type of failure was not in the detection algorithm so there was no hint for you.

Now I have added your scenario and the suggestion is provided to the user. Will be available in the next release.

PockyBum522 commented 2 years ago

That's awesome, thank you!