wslu icon indicating copy to clipboard operation
wslu copied to clipboard

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

Open champignoom opened this issue 2 years ago • 3 comments

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

  • [X] I agree to follow this project's Code of Conduct

champignoom avatar Nov 21 '23 03:11 champignoom

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

patrick330602 avatar Nov 21 '23 03:11 patrick330602

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.

champignoom avatar Nov 21 '23 14:11 champignoom

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

patrick330602 avatar Dec 30 '23 15:12 patrick330602