[Mono-dev] a set of tests to find out the difference between .Net and Mono implementation

何子杰Hzj_jie hzj_jie at hotmail.com
Tue Sep 16 10:10:56 UTC 2014


hi, all,i am trying to move my code <mainly vb.net> from .net to mono, there are ~300 test cases, which can help to find out the difference between .Net and Mono implementation.if you are interesting, you can enlist the code from codeplex, https://geminibranch.codeplex.com/SourceControl/latest#osi/there are several tests folders under root and service, which contains test cases.1. run build.cmd in windows visual studio 2010 higher developer command prompt from osi folder will build and place all the binary and test cases to osi/root/utt/bin/Debug or Release2. run mono-sgen osi.root.utt.exe for all the cases, or mono-sgen osi.root.utt.exe \* -osi.tests.service.storage.* -finalizer_test or mono-sgen osi.root.utt.exe delegate_pinning_test to select some cases to run.
i tried it myself, and find out several issues, which are mainly against Mono 3.10 from development tree.1. GCthought GC.Collect() does not guarantee all the inaccessible objects are finalized and reclaimed, .Net implementation usually be able to delete all the inaccessible objects.impacts, delegate_pinning_test, it make sure the delegate / event in .net will release the object after itself has been released.weak_pointer_test, weak_pointer is a simple wrapper of WeakReference, which is strong-typed.event_disposer_test, event_disposer is a strong-typed pointer, which provide disposing event when disposing.lifetime_binder_test, lifetime_binder is a collection to avoid the object to be finalized.2. char.GetHashCode()the implementation of simhash / himming_distance uses char.GetHashCode(), according to Mono implementation, this function returns char as int, and cause the similarity of two adjusted characters to be small. while .Net implementation seems having some magic. the impact is hamming_distance of "ABC" and "DEF" is 1, instead of a number in range [0, 1).impacts, simhash_test3. System.Threading.Thread.Priority is not implementedimpacts thread_timing_test, thread_timing is an IDisposable to temporarily adjust thread priority.4. Environment.TickCount() is not consistent with DateTime.Nowi.e. DateTime.Now increased 1000 milliseconds, Environment.TickCount() increased only 950 milliseconds. though the definition of Environment.TickCount() and DateTime.Now do not guarantee they are the same, .Net implementation does not have such large difference.impacts, event_comb_waitfor_test, the difference itself is not consistent, so the failures may not happen always.5. Encoding.GetEncoding(string) may not be able to return correct Encoding instance, even the EncodingInfo is from Encoding.GetEncodings()impacts, web_extension_test, according to msdn, the Encoding.GetEncoding(EncodingInfo.WebName) should always return a valid Encoding instance.6. Process.Start does not be able to execute the binary if it does not have execute permissionin Windows platform, the file by default has execute permission, while in Linux, it's not. i do not think this is a Mono issue, but will it be better to help set the execute permission if Process.Start calls a non-executable file? or at least provide a more friendly exception, current the error message is 'Cannot find the specified file', which is confusing.
there are several other issues related to the Thread.ManagedThreadId(), or thread scheduling, <which may more depend on OS>, and cause the cases not be able to run. i am continually working on them. hope i can find out more differences later.
     .Hzj_jie 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140916/edd3d4b2/attachment-0001.html>


More information about the Mono-devel-list mailing list