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

Marek Safar marek.safar at gmail.com
Tue Sep 16 11:31:13 UTC 2014


Hi,

>
>
> i tried it myself, and find out several issues, which are mainly against
> Mono 3.10 from development tree.
>

Thanks for the analysis more comments inline.


> 1. GC
> thought 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.
>

Strictly speaking if something is not guaranteed then even Mono cannot
guarantee it. GC is tricky and we have some holes in our WeakReference
implementation and it'd be helpful if you can provide reliable test case.


> 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_test
>

This is just different implementation detail. You should not rely on exact
GetHashCode result.


> 3. System.Threading.Thread.Priority is not implemented
> impacts thread_timing_test, thread_timing is an IDisposable to temporarily
> adjust thread priority.
>

There is a pull request for this in the queue but it hasn't been merged yet.


> 4. Environment.TickCount() is not consistent with DateTime.Now
> i.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.
>

This could be consider as minor bug, please fill bug report with repro.


> 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.
>

Sound like a bug to me. Could you fill bug report with repro for this.


> 6. Process.Start does not be able to execute the binary if it does not
> have execute permission
>
in 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.
>

We cannot just set the execution permission but reporting more useful
exception is good idea. Could you fill bug/enhancement report for this.


>
> 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.
>

Thanks
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140916/c23a103c/attachment.html>


More information about the Mono-devel-list mailing list