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

C# override member #84

Closed
nojaf opened this issue Jun 13, 2023 · 0 comments · Fixed by #85
Closed

C# override member #84

nojaf opened this issue Jun 13, 2023 · 0 comments · Fixed by #85

Comments

@nojaf
Copy link
Owner

nojaf commented Jun 13, 2023

To reproduce:

  • Add <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
module X.Y.Z

open Microsoft.FSharp.Reflection
open Newtonsoft.Json
open System

[<Sealed>]
type EnumConverter () =
    inherit JsonConverter ()
    let fail s = failwithf "Unable to parse JSON data - %s" s
    override __.WriteJson(writer, value, serialiser) =
        ()
    override __.ReadJson(reader, objectType, existingValue, serialiser) = TimeSpan.Zero
    override __.CanConvert objectType = false

Errors:

Errors in A.fs:
(18,4--19,10): Could not parse:

type A =
    new: unit -> A
    JsonConverter.WriteJson(writer: JsonWriter, value: obj, serializer: JsonSerializer) : unit

(20,4--20,87): Could not parse:

type A =
    new: unit -> A
    JsonConverter.ReadJson(reader: JsonReader, objectType: Type, existingValue: obj, serializer: JsonSerializer) : obj

(21,4--21,45): Could not parse:

type A =
    new: unit -> A
    JsonConverter.CanConvert(objectType: Type) : bool

A.fsi:

module X.Y.Z

open Microsoft.FSharp.Reflection
open Newtonsoft.Json
open System

[<Sealed>]
type EnumConverter =
    new: unit -> EnumConverter
    inherit JsonConverter
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

Successfully merging a pull request may close this issue.

1 participant