wslutilities / wslu

A collection of utilities for Windows Subsystem for Linux
https://wslutiliti.es/wslu
GNU General Public License v3.0
3.44k stars 155 forks source link

Cannot set property. Property setting is supported only on core types in this language mode. #297

Closed champignoom closed 7 months ago

champignoom commented 11 months ago

Windows Version

Windows 10

Windows Build Number

19045.3570

WSL Version

WSL 2

Distro Version

Ubuntu 22.04

WSL Utilities Version

wslu v3.2.3-1; wslview v10

Describe the bug

$ wslview some.pdf
Cannot set property. Property setting is supported only on core types in this language mode.
At line:1 char:1
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]:: ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertySetterNotSupportedInConstrainedLanguage

Cannot invoke method. Method invocation is supported only on core types in this language mode.
At line:1 char:59
+ ... ing]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEnc ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage

coming from: https://github.com/wslutilities/wslu/blob/b6fa4b70b22909337cb13b5b2ea9845f733f60ff/src/wslu-header#L274

Steps to Reproduce

run wslview some.pdf where some.pdf can be anything

Expected behavior

Silence

Additional context

No response

Code of Conduct

patrick330602 commented 11 months ago

You are using the built in version of wslu. Please install the PPA version of wslu: https://wslutiliti.es/wslu/install.html#ubuntu

champignoom commented 11 months ago

Thanks for the advice, but I just tried the PPA version (wslu v4.1.1-1) and the behavior is not changed.

I think the problem is that the line of code referred above doesn't work (only) on powershells in constrained language mode.

patrick330602 commented 9 months ago

Can you see what is the result of $Env:__PSLockdownPolicy in your Powershell?