- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I thought that kind of behavior was just impractical, until I found a copy-pasted snippit of:
Apparently, somehow in a previous compilation of the project this was perfectly reasonable, until I upgraded the library packages and everything fell flat on its face.
Admin
Well the big question is what this sfd thing is (Im' no expert on c#). If it is some custom complex object with a large ToString function which would give a string with spaces (potentially containing specific setup information such as a path), then it could make some sense (barely though, and hope that the path contains no spaces...). however if it is an object which only ever returns a string without spaces (as any sane numeric object should with the potential exception of complex numbers), then yes WTF indeed....
Admin
http://images.rapgenius.com/497sj3akr8x20317bwdmu0vd5.960x720x1.jpg
Admin
You can see the implementation of
FileDialog.ToString
(whichSaveFileDialog
inherits) here.Assuming the dialog has an
ISite
and no exceptions are thrown, it should return a string in the format"{SiteName} [SaveFileDialog]: Title: {Title}, FileName: {FileName}"
(where the text in the braces is replaced with the actual values). The string splitting code at the end of the article seems to be a round-about (and unreliable) way of getting the value of theFileName
property.Admin
Admin
What if the author of that code snippet didn't have online access to microsoft.com, and having a look into the Object Browser was considered un-enterprisey?
Admin
Then he should be fired.
Out of a cannon.
Into the nearest pit of mute killer rabits.
Seriously, just install the MSDN docs locally if you know you're on a spotty Internet connection.
Admin
Though very trying this code is.
Admin
Look at the Object Browser? How dare you even mention such dark magics!
Admin
I prefer looking at the disassembly generated by dotPeek.
Admin
The real WTF is: Why didn't the compiler catch this? If you try to do something similar in C or Java, heck perhaps even JavaScript, your compiler, if not the IDE would've barfed all over it. I know Eclipse does for certain languages point out that this won't work.
Admin
That would require the compiler to do accurate tracing of what is
null
. That sort of thing is often just a warning, and thus susceptible to being disabled in the IDE options…Admin
Yeah, the warning was probably overridden under the same umbrella that forbids the compiler from complaining about unreachable code.
Admin
I've had to integrate a DLL into a project once using only the Object Browser. It kind of sucks. It works, but it sucks.
I to this day do not understand why there's no option in VS to grab the Obejct Browser meta-data and put it in the Intellisense meta-data. That alone would make it 10 times easier.
Admin
:heart_eyes_cat: If you could do that....
For some reason I had in my mind that you could generate .map files for objects. I don't think that actually works for DLL imports (?) but if it did, you could fudge the issue by querying OB and writing out the translation into a .map file.
Admin
There are utilities/add-ins that will do exactly this.
Admin
Please be ReSharper. Please be ReSharper. Please be ReSharper. Please be ReSharper. Please be ReSharper.