-
Notifications
You must be signed in to change notification settings - Fork 25
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
Object reference not set to an instance of an object error while using the TP in Mono #20
Comments
I guess it is something similar to this issue. Some internal code while initializing the type provider is causing the issue. I tried to attach debugger and troubleshoot but it didn't work out as we can't open more than one instance of VS for Mac :( Is there any way that I can troubleshoot this to find the actual error? |
Hi, Thanks for the bug report. A good way to troubleshoot it further would be to use the type provider from a .fsx script file and attach the debugger to fsi.exe. Rezoom.SQL.Provider has an example of this if you F5 it in debug configuration. |
Thanks @rspeele Unfortunately, it didn't work!
|
I tried to troubleshoot this using For this code in user.fsx type QueryWithNullablePar = SQL<"""
select * from Users u
where u.Name is @name
""", "user-migrations"> I put Provider.fs do
printfn "initializing #2" // <----
let tys = [ sqlTy; modelTy ]
tmpAssembly.AddTypes(tys)
this.AddNamespace(rootNamespace, tys)
modelCache.Invalidated.Add(fun _ -> this.Invalidate())
this.Disposing.Add(fun _ -> modelCache.Dispose())
printfn "init success" // <----
static do
printfn "initializing #1" // <----
System.AppDomain.CurrentDomain.add_AssemblyResolve(fun _ args ->
AssemblyResolver.resolve args.Name |> Option.toObj) TypeGeneration.fs let generateSQLType (generate : GenerateType) (sql : string) =
printfn "generating SQL Type" // <----
// ...
provided.AddMember <| generateCommandMethod generate commandEffect commandType commandCtorMethod
printfn "generated SQL type" // <----
provided Here is the output that I got initializing #1
initializing #2
init success
generating SQL Type
generated SQL type
/Users/tamizhvendan/TamizhWorks/temp/Rezoom.SQL/src/Rezoom.SQL.Provider/user.fsx(15,29): error FS3033: The type provider 'Rezoom.SQL.Provider.Provider' reported an error: Object reference not set to an instance of an object I guess I am able to troubleshoot it using |
I haven't the slightest clue where that NRE might be coming from, but I think using this event handler to do some logging might help you obtain a useful stack trace: https://msdn.microsoft.com/en-us/library/system.appdomain.firstchanceexception.aspx |
Unfortunately, it didn't trap the exception! Hi @ovatsus, @andrevdm, Can you folks help here? it is similar to the Fsharp.Data issue but we couldn't able to debug/troubleshoot it |
Leaving a note here that this might fix it: fsprojects/FSharp.TypeProviders.SDK#121 I'm on Windows only at the moment and not able to quickly repro the original issue so I can't tell if upgrading the ProvidedTypes.fs helps at all. |
I tested on ubuntu with Mono 6.0.0 Preview and 5.20.1 Stable (5.20.1.19). Can confirm we still run into the same issue. |
Hi @rspeele,
Thanks a lot for the awesome work.
Today, When I tried to use Rezoom type provider in my Mac using Mono (both 5.0.1 & 5.2.0) I am getting an "Object reference not set to an instance" error
To reproduce it, open the
TypeProviderUsers.sln
file in theRezoom.SQL
in either visual studio code or VS for MacSQLLite Type Provider
Postgres Type Provider
The text was updated successfully, but these errors were encountered: