Skip to content

My Euler2 Solution Throws an Unknown Exception #37

@morgankenyon

Description

@morgankenyon

The following exception is thrown:

Unhandled exception. Wasmtime.WasmtimeException: WebAssembly module 'tinyfs' is not valid: WebAssembly translation error

Caused by:
    Invalid input WebAssembly code at offset 103: type mismatch: expected i32 but nothing on stack
   at Wasmtime.Module.FromBytes(Engine engine, String name, ReadOnlySpan`1 bytes)
   at TinyFS.Cli.Arguments.run(ParseResults`1 parseResults) in C:\dev\tinyfs\cli\Arguments.fs:line 76
   at TinyFS.Cli.Program.main(String[] argv) in C:\dev\tinyfs\cli\Program.fs:line 23
PS C:\dev\tinyfs\examples>

When running this solution to Euler 2

module Euler2

let main () =
    let mutable first = 1
    let mutable second = 2

    let mutable sum = 2
    while second <= 4_000_000 do
        let temp = first + second
        first <- second
        second <- temp

        if second % 2 = 0 then
            sum <- sum + second
        else
            sum <- sum
    sum

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions