This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-09
Channels
- # announcements (2)
- # babashka (11)
- # beginners (9)
- # biff (7)
- # calva (20)
- # catalyst (1)
- # cider (8)
- # clerk (46)
- # clj-kondo (18)
- # clj-otel (2)
- # clojure-brasil (22)
- # clojure-europe (18)
- # clojure-gamedev (23)
- # clojure-italy (5)
- # clojure-nl (2)
- # clojure-norway (14)
- # clojure-uk (6)
- # clr (1)
- # datomic (13)
- # emacs (1)
- # hoplon (13)
- # hyperfiddle (53)
- # introduce-yourself (1)
- # java (23)
- # malli (7)
- # obb (35)
- # off-topic (31)
- # polylith (2)
- # portal (9)
- # rdf (15)
- # reitit (12)
- # releases (3)
- # ring (4)
- # shadow-cljs (6)
- # solo-full-stack (3)
I'm trying to instantiate the https://nodatime.org/ Interval class and run into the following error:
user=> (Interval. (Instant.) (Instant.))
Syntax error (NullReferenceException) compiling new at (REPL:1:2).
The full exception shows:
{:type System.NullReferenceException
:message "Object reference not set to an instance of an object."
:at [System.Diagnostics.StackFrame GetTypeConverter "C:\\work\\clojure-clr\\Clojure\\Clojure\\Runtime\\Converter.cs" 186]}]
:trace
[[System.Diagnostics.StackFrame GetTypeConverter "C:\\work\\clojure-clr\\Clojure\\Clojure\\Runtime\\Converter.cs" 186]
[System.Diagnostics.StackFrame CanConvertFrom "C:\\work\\clojure-clr\\Clojure\\Clojure\\Runtime\\Converter.cs" 69]
[System.Diagnostics.StackFrame CanConvertFrom "NO_FILE" 0]
[System.Diagnostics.StackFrame GetPreferredParameter "NO_FILE" 0]
[System.Diagnostics.StackFrame GetPreferredParameters "NO_FILE" 0]
[System.Diagnostics.StackFrame IsBest "NO_FILE" 0]
[System.Diagnostics.StackFrame SelectBestCandidate "NO_FILE" 0]
[System.Diagnostics.StackFrame MakeBindingTarget "NO_FILE" 0]
[System.Diagnostics.StackFrame ResolveOverload "NO_FILE" 0]
[System.Diagnostics.StackFrame GetMatchingMethodAux "C:\\work\\clojure-clr\\Clojure\\Clojure\\Runtime\\Reflector.cs" 309]
[System.Diagnostics.StackFrame GetMatchingConstructor "C:\\work\\clojure-clr\\Clojure\\Clojure\\Runtime\\Reflector.cs" 258]
[System.Diagnostics.StackFrame ComputeCtor "C:\\work\\clojure-clr\\Clojure\\Clojure\\CljCompiler\\Ast\\NewExpr.cs" 74]
[System.Diagnostics.StackFrame Parse "C:\\work\\clojure-clr\\Clojure\\Clojure\\CljCompiler\\Ast\\NewExpr.cs" 118]
[System.Diagnostics.StackFrame AnalyzeSeq "C:\\work\\clojure-clr\\Clojure\\Clojure\\CljCompiler\\Compiler.cs" 2089]]}
Which leads me https://github.com/clojure/clojure-clr/blob/clojure-1.11.0/Clojure/Clojure/Runtime/Converter.cs#L186 (Clojure CLR 1.11.0):
ConstructorInfo ci = Type.GetType(tca.ConverterTypeName).GetConstructor(Type.EmptyTypes);
I modified the source code and found that Type.GetType(tca.ConverterTypeName)
is returning null.
Printing out tca.ConverterTypeName
gives:
NodaTime.Text.InstantTypeConverter, NodaTime, Version=3.1.9.0, Culture=neutral, PublicKeyToken=4226afe0d9b296d1
These are the constructors for https://github.com/nodatime/nodatime/blob/main/src/NodaTime/Interval.cs:
public Interval(Instant start, Instant end)
public Interval(Instant? start, Instant? end)
And the type has this https://github.com/nodatime/nodatime/blob/fa1e9d340743db540394689e2755d87bee027a23/src/NodaTime/Instant.cs#L36C5-L36C50:
[TypeConverter(typeof(InstantTypeConverter))]
Which leads to this https://github.com/nodatime/nodatime/blob/fa1e9d340743db540394689e2755d87bee027a23/src/NodaTime/Text/TypeConverters.cs#L19:
internal sealed class InstantTypeConverter : TypeConverterBase
Any ideas? Could it be because the InstantTypeConverter extends a generic class? Let me know what more information I can provide, or if the jira board is a more appropriate place to post this.