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

Client site error when trying to build by myself. #10

Open
ingted opened this issue Jan 9, 2023 · 3 comments
Open

Client site error when trying to build by myself. #10

ingted opened this issue Jan 9, 2023 · 3 comments

Comments

@ingted
Copy link

ingted commented Jan 9, 2023

image

@ingted
Copy link
Author

ingted commented Jan 10, 2023

The build was successful but no matter I stay in Bolero 0.14 or 0.20 there are always missing /tmp/mscorlib issue after downloading phase is finished.

@Tarmil
Copy link
Member

Tarmil commented Jan 10, 2023

Yeah this project hasn't been updated in a long time, so it won't work with a recent version of Blazor. It won't be easy to upgrade unfortunately, because both Blazor and and FSharp.Compiler.Service have had significant changes since then.

@harrisse
Copy link

I was able to get past this error by copying files from the browser cache to .net wasm's file system, but wasn't able to get the compiler to recognize any symbols from referenced dlls, e.g. The namespace 'FSharp' is not defined.

And file copying code in case it's useful to anyone else:

export async function loadCachedFiles(loadFile) {
    const cache = await caches.open('blazor-resources-/')
    const keys = await cache.keys()
    for (let i = 0; i < keys.length; i++) {
        const key = keys[i];
        const match = await cache.match(key)
        const buffer = await match.arrayBuffer()
        const stream = DotNet.createJSStreamReference(buffer);
        await loadFile.invokeMethodAsync('Invoke', key.url, stream);
    }
}
type Invocable2<'a, 'b> (f: 'a * 'b -> unit) =
    [<JSInvokable>]
    member this.Invoke(arg1, arg2) =
        f (arg1, arg2)

type Message =
    | Init 
    | LoadFile of Path: string * IJSStreamReference
    | FileLoaded of Path: string

let update message model =
    | Init ->
        let subscribe dispatch =
            let loadFile = Invocable2<string, IJSStreamReference> (LoadFile >> dispatch)
            JS.Module.Task.asyncVoid editorJS "loadCachedFiles" [| loadFile |]
            |> ignore
        model, Cmd.ofSub subscribe
    | LoadFile (path, stream) ->
        let copyFile () =
            task {
                let path = Regex.Replace(path, "^.*_framework/|.sha256.*$", "")
                let path = Path.Combine(Path.GetTempPath(), path)
                use! inStream = stream.OpenReadStreamAsync(Int64.MaxValue)
                use outStream = File.OpenWrite(path)
                let! _ = inStream.CopyToAsync(outStream)
                return path
            }
        model, Cmd.OfTask.either copyFile () FileLoaded Error
    | FileLoaded path -> ...

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

No branches or pull requests

3 participants