[wix-devs] wix4: Handling invalid ids

Bob Arnson bob at firegiant.com
Fri Jan 6 07:16:59 PST 2017


To clarify, CompilerCore.GetAttributeIdentifier returns an id *object* so when it's null, any attempt to access the underlying id string crash immediately. That's different than how a null string works when you're just passing it around.

Now, the easiest way to fix that is with the null-conditional operator: id?.Id would keep the same behavior we have today in wix3 with a null string. But that would require VS2015 as the minimum version required to build WiX. I'm not sure if we're ready for that.

-----Original Message-----
From: wix-devs [mailto:wix-devs-bounces at lists.wixtoolset.org] On Behalf Of Bob Arnson
Sent: Tuesday, 3 January, 2017 13:49
To: WiX Toolset Developer Mailing List <wix-devs at lists.wixtoolset.org>
Subject: [wix-devs] wix4: Handling invalid ids

[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

I opened https://github.com/wixtoolset/issues/issues/5464 when I was finding and fixing the wix4 unit tests (see https://github.com/wixtoolset/wix4/pull/224). What happens is that CompilerCore.GetAttributeIdentifier returns null if the id isn't valid and other Parse* methods use it before checking for a null Id (to generate one, usually). I'm thinking that CompilerCore.GetAttributeIdentifier should throw a warning itself and return a special InvalidIdentifier that's a legal object but distinguishable as invalid for reporting. Anyone have a different suggestion?
____________________________________________________________________
WiX Toolset Developer Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-devs mailing list