Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 64569200B72 for ; Fri, 26 Aug 2016 08:49:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 62C67160AB6; Fri, 26 Aug 2016 06:49:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0BC81160AB0 for ; Fri, 26 Aug 2016 08:49:20 +0200 (CEST) Received: (qmail 27096 invoked by uid 500); 26 Aug 2016 06:49:20 -0000 Mailing-List: contact log4net-dev-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET Dev" List-Id: Delivered-To: mailing list log4net-dev@logging.apache.org Received: (qmail 27086 invoked by uid 99); 26 Aug 2016 06:49:20 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2016 06:49:20 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A91F9180149 for ; Fri, 26 Aug 2016 06:49:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=outlook.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ALzFP86sMoN8 for ; Fri, 26 Aug 2016 06:49:13 +0000 (UTC) Received: from SNT004-OMC4S9.hotmail.com (snt004-omc4s9.hotmail.com [65.55.90.212]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 8540E5F251 for ; Fri, 26 Aug 2016 06:49:12 +0000 (UTC) Received: from NAM01-BY2-obe.outbound.protection.outlook.com ([65.55.90.201]) by SNT004-OMC4S9.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Thu, 25 Aug 2016 23:49:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=skxntw1QETDY+7SyQJoDgqI2DpGNlRVJRNYQ205uuEY=; b=EnHi9mEqd0sHjKZmaY5zFdEoBhYPX0Fi/9kHZq/KCMq2W5WRzDxcb2W3QxE85fUXh6u2Q1pQmP3HudocwVos3njkpTwqryHWsiHIoHAJekbByAk5exYiknftroT5HeJE0sVJxjsHhb7QR1vSZLgjLmmWVgMYdWOpQdWmdP4ldObNOdUPQ1bOKTvvB6jIepp3ea8VpnoM2Pq6/dzrJp4sVTXEDi3MeRnEOrVksurPCLiWkoHoltI2Q1t0zLumkZtcARpjrNSqavEcZsyH9A4pxuAU5V8xQ3IbY+VTnBKd7Q8GUWJCRwcmyFOTQMq3a2N5yJQVt+X7qTjno7CjZlbQsQ== Received: from BY2NAM01FT026.eop-nam01.prod.protection.outlook.com (10.152.68.52) by BY2NAM01HT004.eop-nam01.prod.protection.outlook.com (10.152.68.169) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.6; Fri, 26 Aug 2016 06:49:05 +0000 Received: from SN1PR14MB0318.namprd14.prod.outlook.com (10.152.68.57) by BY2NAM01FT026.mail.protection.outlook.com (10.152.69.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.587.6 via Frontend Transport; Fri, 26 Aug 2016 06:49:04 +0000 Received: from SN1PR14MB0318.namprd14.prod.outlook.com ([10.163.204.12]) by SN1PR14MB0318.namprd14.prod.outlook.com ([10.163.204.12]) with mapi id 15.01.0549.029; Fri, 26 Aug 2016 06:49:03 +0000 From: Dangling Pointer To: Log4NET Dev Subject: Re: String Equality Comparison, Broken Tests and .NET-1.x Thread-Topic: String Equality Comparison, Broken Tests and .NET-1.x Thread-Index: AQHR/HzrBFSqUVePD0iP1Gye7EaYVaBV8L2VgACg54CAA1VTi4AANISAgAArUCyAAHhqgIAAC1d6 Date: Fri, 26 Aug 2016 06:49:03 +0000 Message-ID: References: <87inusceaf.fsf@v45346.1blu.de> , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=softfail (sender IP is 10.152.68.57) smtp.mailfrom=outlook.com; logging.apache.org; dkim=none (message not signed) header.d=none;logging.apache.org; dmarc=fail action=none header.from=outlook.com; received-spf: SoftFail (protection.outlook.com: domain of transitioning outlook.com discourages use of 10.152.68.57 as permitted sender) x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [f2Xdpz4o+To3b6dSMCozI1Xn6aILwvxq] x-eopattributedmessage: 0 x-forefront-antispam-report: CIP:10.152.68.57;IPV:NLI;CTRY:;EFV:NLI;SFV:NSPM;SFS:(10019020)(98900003);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2NAM01HT004;H:SN1PR14MB0318.namprd14.prod.outlook.com;FPR:;SPF:None;LANG:en; x-microsoft-exchange-diagnostics: 1;BY2NAM01HT004;6:sdj3/N0lzv4DSAsYlQgc4tq86hytAZiKaaNo44SqoOerYCua6VP6FvA/j1NTpmDKqq0giC+qpV9lpOdyiFKmXScYNkjcrpKzzOfWvkTJqudAqATwm85KNrTqNTR56bUFN0TAm10Ru+FldqjcxtEcpyfB1eWN/NKfH1N8FWRUrOL1SjXxIvrL+gyP7m24Jhx/VuspwUxyFMAtvGcRNmu11sNVdkjptBSA6TGbOSlFYWF3tOzZx4OP5KcJzlwivJ/twQ5A3Lfxn64ww5tPWVBduMbPhpJrUlYXkSVh2Ts7emE0PHe/5Z4mVkKadn4R1uTP;5:cxUV5J0Fq8qqNK6BK3R8RQEDp7lYc0ryQxtWPe7hMXg/wDeRb2X09lElGLdda9QNcaI1KP4v19f2sTWqrONEhZWT3ROkYzBXUOFkh+2c2ze0IEuo3vvYE7FvXaz7sGz1dQDw+AH4uaFbhe6HPW48qA==;24:GXgcDKgKrU3KACpeuHw8QMOGzZnseN3Sxrjp1q9FpfsfdxFBzkkEoRxwpYmshU7vHWocS06eDBX8E5XJWaokvEmG9WC6RkG0RXiiQgVjqxo=;7:TQ2tSPcUL2p8i6FT2Nlgq+FuR7wvEtDpoh4vnW4I51Sro8PMZ8Yvt7sOwJ3QtwTUFsjwngmAwA74RpGl8DeTbX/EeG36aFOnbyu1jPAdOJLOmwlX7z+3G/nrIGgPd2wSAWNv1q82gmPG3ryikJCxD680WdNF0Z5H0LOGAc7TKa+jD7LOZfBrvSdbZNTVlwOn0kdp/52eObPEhIWokOaIUbnqwjBOsPtoChfwl59WKneuAJhsynv/1CUywupzdxg4 x-ms-office365-filtering-correlation-id: a25bd981-8846-4c5e-8a2b-08d3cd7d117b x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(1601124038)(1601125047);SRVR:BY2NAM01HT004; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(432015012)(82015046);SRVR:BY2NAM01HT004;BCL:0;PCL:0;RULEID:;SRVR:BY2NAM01HT004; x-forefront-prvs: 00462943DE spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_SN1PR14MB0318C3BC8235E8378348D6F5A7EC0SN1PR14MB0318namp_" MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Aug 2016 06:49:03.5285 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2NAM01HT004 X-OriginalArrivalTime: 26 Aug 2016 06:49:06.0420 (UTC) FILETIME=[F09F3340:01D1FF65] archived-at: Fri, 26 Aug 2016 06:49:22 -0000 --_000_SN1PR14MB0318C3BC8235E8378348D6F5A7EC0SN1PR14MB0318namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable For this particular case, I think we don't need to specialize code for vari= ous versions; just using the least common denominator and ToUpperInvariantE= mptyIfNull method without those diabolical #ifdefs would suffice. We can even provide this custom ToUpperEmptyIfNull as string extension meth= od because it is a language feature and framework version doesn't matter: <= LangVersion>6 in csproj, then: internal static string ToUpperInvariantEmptyIfNull (this string input) { return input?.ToUpper(CultureInfo.InvariantCulture) ?? string.Empty; } Usage strA.ToUpperInvariantEmptyIfNull() =3D=3D strB.ToUpperInvariantEmptyI= fNull() This only requires the build machine to have Roslyn installed to compile C#= 6 against whatever version of framework (even .NET1.1). ________________________________ From: Dominik Psenner Sent: Friday, August 26, 2016 5:38:37 AM To: Log4NET Dev Subject: Re: String Equality Comparison, Broken Tests and .NET-1.x On 26 Aug 2016 12:36 a.m., "Dangling Pointer" > wrote: > > Dominik, looks good. I just quickly typed that code in email compose box.= Your changes are good enough to get incorporated in code base and to concl= ude this issue IMO. > > > Agree that the more backward compatible the better. I just raised the poi= nt that if less than 1% of log4net consumers are on net2.0 and lower, then = they most probably are not updating their code or dependency packages to th= e latest versions either. So basically it's just like you said that the new= er version may just focus on mainstream audience; net35 and higher. > > > > You would not throw away a good 25 year old rum either, would you? :-) > > > I wouldn't dare. :) > > But by analogy if it is C lib, I would just comply with C99 and C11 ISO s= tandard and would care less about C89, POSIX'ism etc. Comparing C with .net these standards, the difference is that the langiage = is still mostly the same but other concepts and the API seamlessly evolves.= Choosing a .net framework version is a choice that can be rethought while = the project evolves. The thing I do not like about the log4net codebase is the preprocessor stuf= f. It makes reading and understanding the code almost impossible. Lately I = had the vision to rip apart log4net into several projects where the special= ties of the .net frameworks are handled with overrides/implementation of co= mmon interfaces. But this wont be possible realize with the current manpowe= r. > > ________________________________ > From: Dominik Psenner > > Sent: Thursday, August 25, 2016 7:52:37 PM > > To: Log4NET Dev > Subject: Re: String Equality Comparison, Broken Tests and .NET-1.x > > At first glance this will not compile: > > public static bool NeutralizeString(string input) > { > return string.IsNullOrEmpty(input) && > input.ToUpper(CultureInfo.InvariantCulture); > } > > Further, the name of the method does not fit yet the purpose of the code.= Last but not least, I would advise to make it internal. > > internal static string GetStringOrEmptyIfNull(string input) > if (string.IsNullOrEmpty(input)) > return input.ToUpper(CultureInfo.InvariantCulture; > else > return string.Empty; > > > PS - awesome that log4net has thus far maintain the compatibility with = .NET1.1! but are there still consumers of .NET1.1? > > There has been a discussion about this some time ago. Please check the ma= iling list backlog. The outcome was that we are stopping to maintain everyt= hing that is older than .NET 3.5 (exclusive). If someone wants to have it, = he must A) compile it from source and B) fix the source if it does no longe= r compile. If the effort is cheap, we will however try to keep it compatibl= e because of reasons. Maybe we are just old guys that like good old stuff. = You would not throw away a good 25 year old rum either, would you? :-) > > 2016-08-25 18:59 GMT+02:00 Dangling Pointer >: >> >> > Unfortunately, this doesn't work if `a` is allowed to be null. >> >> >> I made this change in https://github.com/apache/log4net/pull/30. I think= we can use: >> >> trimmedTargetName?.ToUpperInvariant() >> >> in C#6 syntax or the older syntax: >> >> string.IsNullOrEmpty(trimmedTargetName) && trimmedTargetName.ToUpperInva= riant() >> >> to fix this problem. >> >> >> For .NET 1.1 compatibility, we can just use, >> >> string.IsNullOrEmpty(trimmedTargetName) && trimmedTargetName.ToUpper(Cul= tureInfo.InvariantCulture); >> everywhere without branching out with preprocessor directives. >> >> Or maybe a helper method: >> >> public static bool NeutralizeString(string input) >> { >> return string.IsNullOrEmpty(input) && >> input.ToUpper(CultureInfo.InvariantCulture); >> } >> >> Then use NeutralizeString(strA) =3D=3D NeutralizeString(strB) without sp= ecializing for various versions of framework. >> >> PS - awesome that log4net has thus far maintain the compatibility with .= NET1.1! but are there still consumers of .NET1.1? Why would they care to up= date the NuGet package, the next version of log4net, when they don't have t= ime to upgrade their project to newer version of the framework.. just a tho= ught.. :p >> >> ________________________________ >> From: Jonas.Baehr@rohde-schwarz.com > >> Sent: Tuesday, August 23, 2016 1:50:29 PM >> To: Log4NET Dev >> Subject: Re: String Equality Comparison, Broken Tests and .NET-1.x >> >> Stefan Bodewig > wrote on = 23.08.2016 06:14:32: >> >> > Von: Stefan Bodewig > >> > An: "Log4Net Developers List" > >> > Datum: 23.08.2016 06:14 >> > Betreff: Re: String Equality Comparison, Broken Tests and .NET-1.x >> > >> > On 2016-08-22, > wrote: >> > >> > > A recent commit [1] changed, among other things, some string equalit= y >> > > comparisons from `SomeComparer.Compare(a, "B", IgnoreCase) =3D=3D 0`= to >> > > `a.ToUpperInvariant() =3D=3D "B"`, see also [2]. >> > > >> > > Unfortunately, this doesn't work if `a` is allowed to be null. Curre= ntly a >> > > lot of log4net.Tests are broken because of such a null reference exc= eption >> > > in `NewLinePatternConverter.ActivateOptions` (apparently "%newline" = is >> > > quite common in pattern layouts ;-). >> > >> > Oh, I'm sorry. I must admit I glanced over the PR and applied it witho= ut >> > running the tests. My fault. >> > >> > > For new code I tend to opt for `String.Equals(Option, "DOS", >> > > StringComparison.OrdinalIgnoreCase)` for a fast, case-insensitive >> > > comparison with fixed ASCII-only patterns, but static >> > > `String.Equals(String, String, StringComparison)` is not awailable o= n >> > > .NET-1.x [3]. >> > >> > This is what the original code before PR #16 looked like, but it doesn= 't >> > seem to be available for .NET Core, see the discussion around >> > https://github.com/apache/log4net/pull/16/ >> > files#diff-51624ab11a9b3d95cc770de1a4e1bdbc >> >> Note quite, it used `string.compare(string, string, bool, CultireInfo) = =3D=3D 0` which is available on .NET-1.x, while `String.Equals(string, stri= ng StringComparison)` and `ToUpperInvariant` are not. >> >> > > Should we create some helper in SystemInfo that provides null-aware, >> > > ordinal, casing-agnostic string equality comparison, with some #if's >> > > .NET-1.x? >> > >> > +1 >> >> Here you go. The attached patch introduces a `SystemInfo.EqualsIgnoringC= ase(string, string)`, some unit tests, and fixes `NewLinePatternConverter.A= ctivateOptions` so that the test suite passes again. >> >> Please note that I was only able to test with .NET-4.5.2. I have no .NET= -1x around, nor .NET Core (maybe we can even drop this #elif). I used the c= ode for these platforms from previous revisions of NewLinePatternConverter.= cs. In addition, I'm not sure if I got all the defines for the #if right. I= s there some doc for that? >> >> regards, >> Jonas >> > > > > -- > Dominik Psenner --_000_SN1PR14MB0318C3BC8235E8378348D6F5A7EC0SN1PR14MB0318namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

For this particular case, I think we don't need to specialize code for v= arious versions; just using the least common denominator and ToUpperInvariantEmptyIfNull metho<= /font>d without those diabolical #ifdefs would suffice.


We can even provide this custom ToUpperEmptyIfNull as string extens= ion method because it is a language feature and framework version doesn't m= atter: <LangVersi= on>6</LangVersion> in csproj, then:


internal static string ToUpperInvariantEmptyIfNull (this string input)

{

    return input?.ToUpper(= CultureInfo.InvariantCulture) ?? string.Empty;

}


Usage strA.ToUpperInvariantEmptyIfNull() =3D=3D strB.ToUpperInvari= antEmptyIfNull()


This only requires the build machine to have Roslyn installed to compile= C#6 against whatever version of framework (even .NET1.1).




From: Dominik Psenner <d= psenner@gmail.com>
Sent: Friday, August 26, 2016 5:38:37 AM
To: Log4NET Dev
Subject: Re: String Equality Comparison, Broken Tests and .NET-1.x
 

On 26 Aug 2016 12:36 a.m., "Dangling Pointer" <= danglingpointer@outlook.com<= /a>> wrote:
>
> Dominik, looks good. I just quickly typed that code in email compose b= ox. Your changes are good enough to get incorporated in code base and to co= nclude this issue IMO.
>
>
> Agree that the more backward compatible the better. I just raised the = point that if less than 1% of log4net consumers are on net2.0 and lower, th= en they most probably are not updating their code or dependency packag= es to the latest versions either. So basically it's just like you said that the newer version may just focus on mainstrea= m audience; net35 and higher.
>
>
> > You would not throw away a good 25 year old rum either, would you= ? :-)
>
>
> I wouldn't dare. :)
>
> But by analogy if it is C lib, I would just comply with C99 and C11 IS= O standard and would care less about C89, POSIX'ism etc.

Comparing C with .net these standards, the difference is tha= t the langiage is still mostly the same but other concepts and the API seam= lessly evolves. Choosing a .net framework version is a choice that can be r= ethought while the project evolves.

The thing I do not like about the log4net codebase is the pr= eprocessor stuff. It makes reading and understanding the code almost imposs= ible. Lately I had the vision to rip apart log4net into several projects wh= ere the specialties of the .net frameworks are handled with overrides/implementation of common interfaces. But this w= ont be possible realize with the current manpower.

>
> ________________________________
> From: Dominik Psenner <
dpsenn= er@gmail.com>
> Sent: Thursday, August 25, 2016 7:52:37 PM
>
> To: Log4NET Dev
> Subject: Re: String Equality Comparison, Broken Tests and .NET-1.x
>  
> At first glance this will not compile:
>
> public static bool NeutralizeString(string input)
> {
>     return string.IsNullOrEmpty(input) &&<= br> >            &nbs= p;    input.ToUpper(CultureInfo.InvariantCulture);
> }
>
> Further, the name of the method does not fit yet the purpose of the co= de. Last but not least, I would advise to make it internal.
>
> internal static string GetStringOrEmptyIfNull(string input)
>   if (string.IsNullOrEmpty(input))
>     return input.ToUpper(CultureInfo.InvariantCulture;
>   else
>     return string.Empty;
>
> > PS - awesome that log4net has thus far maintain the com= patibility with .NET1.1! but are there still consumers of .NET1.1?
>
> There has been a discussion about this some time ago. Please check the= mailing list backlog. The outcome was that we are stopping to maintain eve= rything that is older than .NET 3.5 (exclusive). If someone wants to have i= t, he must A) compile it from source and B) fix the source if it does no longer compile. If the effort is cheap= , we will however try to keep it compatible because of reasons. Maybe = we are just old guys that like good old stuff. You would not throw away a g= ood 25 year old rum either, would you? :-)
>
> 2016-08-25 18:59 GMT+02:00 Dangling Pointer <danglingpointer@outlook.com>:
>>
>> > Unfortunately, this doesn't work if `a` is allowed to be null= .
>>
>>
>> I made this change in https://github.com/apache/log4net/pull/30. I think we can use= :
>>
>> trimmedTargetName?.ToUpperInvariant()
>>
>> in C#6 syntax or the older syntax:
>>
>> string.IsNullOrEmpty(trimmedTargetName) && trimmedTargetNa= me.ToUpperInvariant()
>>
>> to fix this problem.
>>
>>
>> For .NET 1.1 compatibility, we can just use,
>>
>> string.IsNullOrEmpty(trimmedTargetName) && trimmedTargetNa= me.ToUpper(CultureInfo.InvariantCulture);
>> everywhere without branching out with preprocessor directives.
>>
>> Or maybe a helper method:
>>
>> public static bool NeutralizeString(string input)
>> {
>>     return string.IsNullOrEmpty(input) && >>            =      input.ToUpper(CultureInfo.InvariantCulture);
>> }
>>
>> Then use NeutralizeString(strA) =3D=3D NeutralizeString(strB) with= out specializing for various versions of framework.
>>
>> PS - awesome that log4net has thus far maintain the compatibility = with .NET1.1! but are there still consumers of .NET1.1? Why would they care= to update the NuGet package, the next version of log4net, when they don't = have time to upgrade their project to newer version of the framework.. just a thought.. :p
>>
>> ________________________________
>> From: Jonas.Baehr= @rohde-schwarz.com <Jonas.Baehr@rohde-schwarz.com>
>> Sent: Tuesday, August 23, 2016 1:50:29 PM
>> To: Log4NET Dev
>> Subject: Re: String Equality Comparison, Broken Tests and .NET-1.x=
>>  
>> Stefan Bodewig <bodewig@a= pache.org> wrote on 23.08.2016 06:14:32:
>>
>> > Von: Stefan Bodewig <bodewig@apache.org>
>> > An: "Log4Net Developers List" <log4net-dev@logging.apache.org>
>> > Datum: 23.08.2016 06:14
>> > Betreff: Re: String Equality Comparison, Broken Tests and .NE= T-1.x
>> >
>> > On 2016-08-22, <Jonas.Baehr@rohde-schwarz.com> wrote:
>> >
>> > > A recent commit [1] changed, among other things, some st= ring equality
>> > > comparisons from `SomeComparer.Compare(a, "B",= IgnoreCase) =3D=3D 0` to
>> > > `a.ToUpperInvariant() =3D=3D "B"`, see also [2= ].
>> > >
>> > > Unfortunately, this doesn't work if `a` is allowed to be= null. Currently a
>> > > lot of log4net.Tests are broken because of such a null r= eference exception
>> > > in `NewLinePatternConverter.ActivateOptions` (apparently= "%newline" is
>> > > quite common in pattern layouts ;-).
>> >
>> > Oh, I'm sorry. I must admit I glanced over the PR and applied= it without
>> > running the tests. My fault.
>> >
>> > > For new code I tend to opt for `String.Equals(Option, &q= uot;DOS",
>> > > StringComparison.OrdinalIgnoreCase)` for a fast, case-in= sensitive
>> > > comparison with fixed ASCII-only patterns, but static >> > > `String.Equals(String, String, StringCompari= son)` is not awailable on
>> > > .NET-1.x [3].
>> >
>> > This is what the original code before PR #16 looked like, but= it doesn't
>> > seem to be available for .NET Core, see the discussion around=
>> > https:= //github.com/apache/log4net/pull/16/
>> > files#diff-51624ab11a9b3d95cc770de1a4e1bdbc
>>
>> Note quite, it used `string.compare(string, string, bool, CultireI= nfo) =3D=3D 0` which is available on .NET-1.x, while `String.Equals(string,= string StringComparison)` and `ToUpperInvariant` are not.
>>
>> > > Should we create some helper in SystemInfo that provides= null-aware,
>> > > ordinal, casing-agnostic string equality comparison, wit= h some #if's
>> > > .NET-1.x?
>> >
>> > +1
>>
>> Here you go. The attached patch introduces a `SystemInfo.EqualsIgn= oringCase(string, string)`, some unit tests, and fixes `NewLinePatternConve= rter.ActivateOptions` so that the test suite passes again.
>>
>> Please note that I was only able to test with .NET-4.5.2. I have n= o .NET-1x around, nor .NET Core (maybe we can even drop this #elif). I used= the code for these platforms from previous revisions of NewLinePatternConv= erter.cs. In addition, I'm not sure if I got all the defines for the #if right. Is there some doc for that?
>>
>> regards,
>> Jonas
>>
>
>
>
> --
> Dominik Psenner

--_000_SN1PR14MB0318C3BC8235E8378348D6F5A7EC0SN1PR14MB0318namp_--