[Mono-dev] Patch 1/2 - System.Diagnostics.Contracts in corlib

Miguel de Icaza miguel at novell.com
Sun Jun 20 12:37:53 EDT 2010


Hello,

    Update: I did not commit the tests, since I am waiting for these patches
to be fixed.

Miguel.

On Fri, Jun 18, 2010 at 5:53 AM, Marek Safar <marek.safar at seznam.cz> wrote:

> Hello,
> > Some of the existing code was protected by "#if NET_2_1 || NET_4_0"
> > (e.g. PureAttribute)
> > And other parts of the code were always compiled, but made internal if
> > not NET_2_1 or NET_4_0 (e.g. Contract.cs)
> > So I left these as they are, and did the same in new files that I
> > introduced, which meant the call to Environment.FailFast() had to have
> > the additional "#if NET_4_0".
> > However, if it would be better to change all files to be completely
> > surrounded by "#if NET_4_0" then please let me know.
> Keep existing code without change and any new stuff add as NET_4_0 only
>
> >
> > The private exception class ContractException is specified in the MS
> > documentation:
> > http://research.microsoft.com/en-us/projects/contracts/userdoc.pdf
> > See sections 7.6, 7.3, 7.4
> > And I have verified what I have implemented is the same as MS.
> Quite strange design but fair enough
> >
> > The private exception class ContractShouldAssertException is because,
> > in some circumstances, the code should Assert, but there appears to be
> > no simple way to do this from within corlib, so I throw this exception
> > instead. However, this will never occur because it is guarded by "if
> > (Environment.UserInteractive)" which currently always returns false. I
> > have put a FIXME comment at both places in the code where this is
> > done. If there is a better way to implement this, please let me know.
> This is trick you will have to try to implement it "correctly" yourself
> or ask runtime guys to do it. My understanding is that you want to
> terminate the process without missing any catch/finally clause but
> without throwing an exception (could be captured at higher level and
> stop the shutdown).
>
> Good work, you can commit the patch after the minor fixes.
>
> Thanks
> Marek
>
> >
> > Kind regards
> > Chris
> >
> > Marek Safar wrote:
> >> Hello,
> >>
> >> Few comments from me
> >>
> >> - All code is #if NET_4_0 there is no need for further nested #if
> >> - Why did you have to introduce private exception classes ?
> >>
> >> Marek
> >>
> >>>>
> >>>>
> >>>>> -----Ursprüngliche Nachricht-----
> >>>>> Von: mono-devel-list-bounces at lists.ximian.com
> >>>>> [mailto:mono-devel-list-
> >>>>> bounces at lists.ximian.com] Im Auftrag von Chris Bacon
> >>>>> Gesendet: Mittwoch, 16. Juni 2010 12:03
> >>>>> An: Marek Safar
> >>>>> Cc: mono-devel-list at lists.ximian.com
> >>>>> Betreff: Re: [Mono-dev] Patch 1/2 - System.Diagnostics.Contracts in
> >>>>> corlib
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> Attached is a new, improved, patch that keeps existing formatting.
> >>>>> Sorry for the mistake.
> >>>>>
> >>>>> Kind regards
> >>>>> Chris
> >>>>>
> >>>>> Marek Safar wrote:
> >>>>>
> >>>>>> Hi Chris,
> >>>>>>
> >>>>>>> Attached is a patch to corlib containing updates the
> >>>>>>> System.Diagnostics.Contracts as part of the GSoC work I am doing.
> >>>>>>>
> >>>>>>> I'm sure there will be parts of this I haven't done quite right, so
> >>>>>>> please let me know what they are, and I'll sort them out.
> >>>>>>>
> >>>>>> Can you keep existing formatting, most of the changes are about
> >>>>>> changing tabs to spaces. Please send a new set of patches without
> >>>>>> any
> >>>>>> noise (lines you have not changed)
> >>>>>>
> >>>>>> Thanks
> >>>>>> Marek
> >>>>>>
> >>>>
> >>>>
> >>
> >
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100620/42845963/attachment.html 


More information about the Mono-devel-list mailing list