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

Null reference exception in Escaping.escape #86

Open
haf opened this issue Apr 3, 2017 · 10 comments
Open

Null reference exception in Escaping.escape #86

haf opened this issue Apr 3, 2017 · 10 comments

Comments

@haf
Copy link
Contributor

haf commented Apr 3, 2017

  System.NullReferenceException: Object reference not set to an instance of an object
  at [email protected] (System.Collections.Generic.IEnumerable`1[System.Char]& next) [0x00028] in Chiron.fs:401
  at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T].MoveNextImpl () [0x00017] in /private/tmp/mono--fsharp-20170301-46369-1vnanly/src/fsharp/FSharp.Core/seq.fs:781
  at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T].System-Collections-IEnumerator-MoveNext () [0x00000] in /private/tmp/mono--fsharp-20170301-46369-1vnanly/src/fsharp/FSharp.Core/seq.fs:812
  at Microsoft.FSharp.Collections.SeqModule.ToList[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in /private/tmp/mono--fsharp-20170301-46369-1vnanly/src/fsharp/FSharp.Core/seq.fs:559
  at Chiron+Escaping.escape (System.String s) [0x00010] in <58e26eef7a9f4a1fa7450383ef6ee258>:0
  at Chiron+Formatting.formatString (System.String _arg7) [0x00000] in Chiron.fs:692
  at Chiron+Formatting.formatJson (System.Int32 level, Chiron+Formatting+JsonFormattingOptions options, Chiron+Json _arg1) [0x00082] in Chiron.fs:661

For the last release, unknown tag.

Repro:

Object (Map [("key", String null)]) |> Json.serialize
@neoeinstein
Copy link
Member

The internal type escape@401-1 exists in Chiron 6.2.0. Upgrading to 6.2.1 should solve this issue along with #64.

@haf
Copy link
Contributor Author

haf commented Apr 3, 2017

Testing...

@haf
Copy link
Contributor Author

haf commented Apr 3, 2017

No, I'm already using Chiron 6.2.1

@neoeinstein
Copy link
Member

Then the stack trace is suspect. escape@401-1 does not exist in Chiron 6.2.1.

@haf
Copy link
Contributor Author

haf commented Apr 3, 2017

Well, that's because there are no tags on this repo and I took an arbitrary commit to get some sort of debug symbols... :-s

@haf
Copy link
Contributor Author

haf commented Apr 3, 2017

Does the repro fail for you?

@haf
Copy link
Contributor Author

haf commented Apr 3, 2017

I just tried pdb2mdb with this result:

$ pdb2mdb packages/Chiron/lib/net40/Chiron.dll
$ xbuild /t:Rebuild ... fsproj && mono --debug ...exe
Symbol file Tests/bin/Debug/Chiron.dll.mdb doesn't match image Tests/bin/Debug/Chiron.dll

I also tried to verify the version of Chiron, but there's none in the DLL:

$ monodis --assembly Tests/bin/Debug/Chiron.dll | grep VERSION
$

@neoeinstein
Copy link
Member

On Windows, I have no issues with a build from clean. I'll have to see if I can get a mono build going this evening.

@haf
Copy link
Contributor Author

haf commented Apr 5, 2017

Did you see it? :)

@laygr
Copy link

laygr commented Jul 9, 2017

As a little hack, I wrote this:

type Json with
    static member writeCaringForNull (key: string) value =
        json {
            if isNull value
            then do! Json.writeNone key
            else do! Json.write key value
        }

then, you can do this:

json {
     do! Json.writeCaringForNull aKey aValue
}

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