maxmind/GeoIP2-dotnet

DatabaseReader constructor yields an exception on .Net Core / Windows 8.1

flo8 opened this issue · 7 comments

flo8 commented

Hi,
I got a strange behavior with the DatabaseReader constructor with .Net Core on Windows 8.1. The mmdb does exist but I get a FileNotFoundException. When writing the very exact same code on a .Net 4.6 C# app, it loads without any problem. Any idea why?
problem

That is pretty weird. Is there anything unusual about the database you are trying to load? For instance, is it on a network drive?

flo8 commented

There was nothing unusual. The only thing I can think of is that this function is not executed on the main thread of the app.. However it is very weird that the very same program in .Net 4.6 running on the same machine, at the same time, with the same file, works without any problem?
I also found that if I use the constructor with the FileAccessMode.Memory then it works (even in the child thread).

Do our tests run fine for you? They should use the constructor in the same way. Would it be possible for you to create a small test solution or test case that demonstrates the issue?

i'm getting this error also. using FileAccessMode.Memory in the ctor makes it work. the problem only occurs on dotnet core under windows (i'm on Win2k16). works find under debian 9.

FYI.... hah! the issue is a red herring. the exception happens internal to the MMF code in the dotnet base libraries and is caught and handled. The code works fine! I got confused (like the author) due to my default setting of "break on all exceptions" inside the debugger.

@coderb, thanks for the explanation. That makes sense. @flo8, does that explain what you were seeing or do you still have problems with the "break on all exceptions" option disabled?

Based on the last comment, I am going to close this issue. I am happy to reopen it if there is an indication that it is not a red herring.