bchavez / RethinkDb.Driver

:headphones: A NoSQL C#/.NET RethinkDB database driver with 100% ReQL API coverage.
http://rethinkdb.com/api/java
Other
383 stars 134 forks source link

System.NullReferenceException #155

Closed DrewRidley closed 3 years ago

DrewRidley commented 3 years ago

Version Information

Software Version(s)
NuGet Package latest
Driver Windows OS? yes
Visual Studio? no, Rider
RethinkDB Server 2.3.6
Server Windows OS? yes

Query: var user = await R.Db("lrp_core").Table("users").Get("someProcedurallyFoundKey").RunAtomAsync<User>(_conn);

What is the expected behavior?

Running a query should not throw a NullReferenceException.

What is the actual behavior?

Running a query throws a NullReferenceException.

Please provide a unit test that demonstrates the bug.

image

Not sure how to create a Unit test for this edge case, but one potential route would be to use mono, and load an assembly with assembly.load() and see if running a query inside the loaded assembly throws a null reference exception

Other notes on how to reproduce the issue?

The project I am running is inside a framework called FiveM, which loads the assemblies at runtime in mono with Assembly.Load(). Perhaps a good way to reproduce would be to load a project inside mono with Assembly.Load() and attempt a query. The query is never actually run on the server, which could provide some valuable information on where the null reference occurs.

Any possible solutions?

Potentially, find out why there is a nullreference in my runtime environment but not others (net framework, net core, etc)

Can you identify the location in the driver source code where the problem exists?

No clue, but I am 100% certain the null reference is nowhere in my code, as its the query specifically that causes the null reference. I do have a suspicion that ReThinkDB is having trouble referencing my User object but I am not sure.

If the bug is confirmed, would you be willing to submit a PR?

Potentially, I have limited knowledge on how RethinkDB works.

Yes / No (Help can be provided if you need assistance submitting a PR) Yes

DrewRidley commented 3 years ago

I am 100% clueless on why this is happening, but the parent method that invokes the Query returned a Task. Changing the method signature to void completely removes the nullreference. I have to assume this is a bug with mono. Sorry for the troubles.