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

error FS0193: Operation is not supported on this platform. #1859

Open
jkone27 opened this issue Apr 3, 2023 · 17 comments
Open

error FS0193: Operation is not supported on this platform. #1859

jkone27 opened this issue Apr 3, 2023 · 17 comments

Comments

@jkone27
Copy link

jkone27 commented Apr 3, 2023

Describe the bug

I have a compiling script in F#

Steps to reproduce

not clear, but sometimes happens in interactive while running the code with ALT-ENTER, not able to reproduce consistently yet.

Link to sample reproduction

Expected behaviour

no errors as the code is valid F# code

Machine info

  • OS: Mac
  • .NET SDK version: 7.0.202
  • Ionide version: 7.5.2
@7enderhead
Copy link

I see this phenomenon, too. Linux Mint 20.3, VS Code 1.78.2, Ionide 7.5.4. The following code snippet, sent to an FSI terminal, works with dotnet 6.0.488 installed, but not with 7.0.302 or 8.0.100-preview.4.23260.5:

(* ~\~ language=FSharp filename=src/dnlib-testbed.fsx *)
(* ~\~ begin <<lit/dnlib-testbed.md|src/dnlib-testbed.fsx>>[init] *)
#if INTERACTIVE
(* ~\~ begin <<lit/dnlib-testbed.md|import-nugets>>[init] *)
#r "nuget:Microsoft.CodeAnalysis.CSharp" 
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-nugets>>[1] *)
#r "nuget:dnlib"
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-nugets>>[2] *)
#r "nuget:spkl.Diffs"
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-nugets>>[3] *)
#r "nuget:xunit"
#r "nuget:Unquote"
(* ~\~ end *)
#endif

(* ~\~ begin <<lit/dnlib-testbed.md|import-ms-codeanalysis>>[init] *)
open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.CSharp
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-dnlib>>[init] *)
open dnlib.DotNet
open dnlib.DotNet.Emit
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-spkl-diffs>>[init] *)
open spkl.Diffs
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-dotnet>>[init] *)
open System
open System.IO
open System.Reflection
open System.Collections.Generic
open System.Text.RegularExpressions
(* ~\~ end *)

It seems to be that it's really the block comments that make Ionide trip:

- (* ~\~ end *)
- (* ~\~ begin <<lit/dnlib-testbed.md|impor

error FS0193: Operation is not supported on this platform.

> -dnlib>>[init] *)

@jkone27
Copy link
Author

jkone27 commented May 31, 2023

I had the same with // comments i think

@jkone27
Copy link
Author

jkone27 commented Jun 7, 2023

Does this happen only with NET7 and NET8? can someone else check this? i am on MacOS, is there any way to reproduce in tests if there is tests for comment sections? (comments parsed correctly in FSI by ionide)

@jkone27
Copy link
Author

jkone27 commented Jun 7, 2023

"You are running .Net Core version of FsAutoComplete, we recommend also using .Net Core version of F# REPL (`dotnet fsi`). Should we change your settings (`FSharp.useSdkScripts`). This requires .Net Core 3.X?",
--> do we have a way to add unit tests?

@baronfel
Copy link
Contributor

baronfel commented Jun 7, 2023

We don't have tests for the Ionide layer itself, but it is possible to test excursions to some degree. I'm not really familiar with it though.

The 'send to FSI' interaction is really simplistic, it's possible that we may need to escape certain syntax when sending it via stdin for example.

@7enderhead
Copy link

Does this happen only with NET7 and NET8? can someone else check this? i am on MacOS, is there any way to reproduce in tests if there is tests for comment sections? (comments parsed correctly in FSI by ionide)

I have seen the phenomenon in different forms on several machines, and on some it doesn't work with dotnet 6.x either (especially if dotnet is installed via the Linux distribution's package manager system).

I have actually set up a new development Linux machine, and the criterion was whether VS Code/Ionide/dotnet (7) "out of the box" do not exhibit the behavior.

@jkone27
Copy link
Author

jkone27 commented Sep 28, 2023

i get it also with this script in fsx when running portions with alt/option + enter

open System

type Message = string * AsyncReplyChannel<string>

let replyAgent =
    MailboxProcessor<Message>.Start(fun inbox ->
    let rec loop () =
        async {
            let! (message, replyChannel) = inbox.Receive()
            replyChannel.Reply(String.Format("Received message: {0}", message))
            do! loop ()
        }
    loop ())

replyAgent.PostAndReply(fun rc -> "Hello", rc)

macos net7 SDK lts

dotnet --version
7.0.401

@TheAngryByrd
Copy link
Member

There are two issues about similar errors in the fsharp repo:

dotnet/fsharp#14160 dotnet/fsharp#14946

@HoraceGonzalez
Copy link
Contributor

I'm able to workaround this by adding the --readline- parameter to my user settings:

    "FSharp.fsiExtraParameters": [
        "--readline-"
    ],

@jkone27
Copy link
Author

jkone27 commented Oct 14, 2023

doesn't fully solve for me, the error is gone but in ionide still hangs with no completion, even after #quit;; and re-send to interactive with option/alt + enter

@jkone27
Copy link
Author

jkone27 commented Jan 19, 2024

image still have this issue... does other people have this? I am on macOS and dotnet 8 latest ionide v7.17.0

@Titaye
Copy link
Contributor

Titaye commented Jan 19, 2024 via email

@baronfel
Copy link
Contributor

@Titaye that's really useful info! I had no idea the terminal pane could impact things to this degree.

@MangelMaxime
Copy link
Contributor

I can confirm that the size of the terminal can have this impact. I was actually seeing this behaviour without knowing it as I always resized my terminal when a line that I paste in it is too long and not interpreted correctly.

@baronfel
Copy link
Contributor

It looks like there may be some API we can use to get the dimensions of the terminal: microsoft/vscode#67919

This might be usable to modify the message we send to make it usable by the terminal.

@MangelMaxime
Copy link
Contributor

MangelMaxime commented Jan 19, 2024

I don't think we can easily reformat the code sent.

Imagine we have this code:

let x = DateTime(2014, 7, 1, 16, 37, 0, DateTimeKind.Utc).ToString("""r \\\zz""", CultureInfo.InvariantCulture)
                                            ^

and the terminal can accept up to the ^ character. How would we cut that line?

Perhaps, detecting the size of the terminal and generating a message box to explain that the terminal is too small or that the line at X is too long is possible solution if we can't reformat the line of code.

@baronfel
Copy link
Contributor

in extreme cases we could ask fantomas to reformat it with a given maximum width, but yeah it's probably impossible to do correctly in the general case.

starting to sound like something that we can't truly fix until/unless we move away from dotnet fsi usage directly and into managing a series of FsiEvaluationSessions inside FSAC or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants