Bug 2879 - EntryPointNotFoundException when using System.DateTime.Now
Summary: EntryPointNotFoundException when using System.DateTime.Now
Status: RESOLVED INVALID
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-01-13 08:44 UTC by Paul Buonopane
Modified: 2012-01-13 13:33 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Paul Buonopane 2012-01-13 08:44:22 UTC
Description of Problem:
System.DateTime.Now throws an EntryPointNotFoundException.


Steps to reproduce the problem:
1. Start with CentOS 5.5 x64.
2. Download and extract Mono nightly tarball.
3. ./configure --prefix=/usr --libdir=/usr/lib64
4. make
5. sudo make install
6. Compile an application that references the System.DateTime.Now getter.
7. Run it using "mono XXXX.exe"


Actual Results:

Mono: DllImport attempting to load: '__Internal'.
Mono: Searching for 'FileTimeToSystemTime'.
Mono: AOT FOUND method System.DateTime:ToFileTime () [0x2aaaaae2ced0 - 0x2aaaaae2cf60 0x2aaaab0f6e6a]

System.EntryPointNotFoundException: FileTimeToSystemTime
  at (wrapper managed-to-native) Aselia.Core.Security.CertificateGenerator/NativeMethods:FileTimeToSystemTime (long&,Aselia.Core.Security.CertificateGenerator/SystemTime&)
  at Aselia.Core.Security.CertificateGenerator.ToSystemTime (DateTime dateTime) [0x00000] in <filename unknown>:0
  at Aselia.Core.Security.CertificateGenerator.CreateSelfSignCertificatePfx (System.String x500, DateTime startTime, DateTime endTime, System.Security.SecureString password) [0x00000] in <filename unknown>:0
  at Aselia.Core.Security.CertificateGenerator.CreateSelfSignCertificatePfx (System.String x500, DateTime startTime, DateTime endTime, System.String insecurePassword) [0x00000] in <filename unknown>:0
  at Aselia.Core.Security.CertificateManager.Generate (System.String id, System.String password) [0x00000] in <filename unknown>:0



Expected Results:
Getter should return a System.DateTime instance representing the date/time when it was called.


How often does this happen?
Always.


Additional Information:
N/A
Comment 1 Paul Buonopane 2012-01-13 08:49:53 UTC
I missed some of the debug output.  Here's a more complete segment:


Mono: DllImport attempting to load: '__Internal'.
Mono: Searching for 'FileTimeToSystemTime'.
Mono: AOT FOUND method System.DateTime:ToFileTime () [0x2aaaaae2ced0 - 0x2aaaaae2cf60 0x2aaaab0f6e6a]

Mono: AOT FOUND method System.DateTime:ToUniversalTime () [0x2aaaaae2d3b0 - 0x2aaaaae2d3f0 0x2aaaab0f6ea9]

Mono: AOT FOUND method System.TimeZone:ToUniversalTime (System.DateTime) [0x2aaaaae73160 - 0x2aaaaae73340 0x2aaaab0f8cdf]

Mono: DllImport attempting to load: '__Internal'.
Mono: Searching for 'FileTimeToSystemTime'.
Mono: AOT FOUND method System.EntryPointNotFoundException:.ctor () [0x2aaaaae3c890 - 0x2aaaaae3c8c0 0x2aaaab0f7513]
Comment 2 Alan McGovern 2012-01-13 09:33:03 UTC
Can you run your application with this commandline parameter and see if it works then:  -O=-aot

If this fixes it, it is quite possible that clearing all cached AOT libraries will fix it. It could also simply be a temporary regression from the nightly build and could already be fixed.
Comment 3 Paul Buonopane 2012-01-13 10:05:08 UTC
mono -O=-aot XXXXX.exe does not resolve the problem.

It does not appear to be a simple regression, based on the commit history.  I'll try cloning directly from GitHub instead of using the tarball, though, since the tarball seems to be a few days behind.
Comment 4 Alan McGovern 2012-01-13 10:07:09 UTC
If you are still getting AOT related messages in the mono debug output with AOT disabled, then something has definitely gone very very wrong. Can you confirm that you are still getting those even with the flag to disable aot.
Comment 5 Paul Buonopane 2012-01-13 10:16:24 UTC
I have no idea what AOT is, but I am still getting that particular exception.
Comment 6 Paul Buonopane 2012-01-13 10:20:10 UTC
Oh, the AOT compiler.  I've already uninstalled mono and I'm installing from a git clone, but I'll copy exactly what I get with AOT disabled once it's re-installed, provided it hasn't been fixed.
Comment 7 Zoltan Varga 2012-01-13 11:22:20 UTC
According to the stack trace, the exception is thrown from non-mono code:

System.EntryPointNotFoundException: FileTimeToSystemTime
  at (wrapper managed-to-native)
Aselia.Core.Security.CertificateGenerator/NativeMethods:FileTimeToSystemTime
(long&,Aselia.Core.Security.CertificateGenerator/SystemTime&)
  at Aselia.Core.Security.CertificateGenerator.ToSystemTime (DateTime dateTime)
[0x00000] in <filename unknown>:0
Comment 8 Paul Buonopane 2012-01-13 11:39:57 UTC
No, it's within mono.  It's looking for the native method FileTimeToSystemTime internally.  On Windows, it would be an external call to advapi32.dll, but not on POSIX.
Comment 9 Alan McGovern 2012-01-13 11:44:47 UTC
Can you attach the program you're using to test mono if it is not just a simple console application doing this:

public static void Main (string[] args) {
    Console.WriteLine (DateTime.Now); 
}
Comment 10 Paul Buonopane 2012-01-13 13:33:59 UTC
Well, I feel rather stupid.  I found a library that I was using that was importing DLLs such as kernel32.dll and advapi32.dll--which obviously doesn't work outside of Windows.  I had checked that library previously, but somehow I missed the imports.