The Infuriating C# Out-of-Code References
I love C#. It takes everything I loved about my years programming in early Java and adds boatloads of wonderful. But, there is one thing that perpetually infuriates me. All C# source code includes coder-included class, type, and other references that are all relative to a list of "using" statements at the top of the source code file and also a list of libraries managed separately in the Visual Studio UI. The problem is that all the wonderfully helpful source code that people post on the web never includes these UI-managed library references, which means that any time you copy and paste those bits of C# source code you will get lots of squiggly red lines telling you that Visual Studio has no idea to what the classes, types, etc. given in the source code refer. And since I've just searched the web because I didn't know how to solve a problem or because I'm learning some new framework or paradigm via some example on a page, I usually have no idea what library or libraries I need to reference in order for all the dependencies to be satisfied.
Case in point, I just had a look at the Google Drive API "Quickstart". They show you a simple snippet of source code you are supposed to try yourself. They do not give you a Visual Studio project, just the code on the screen you need to copy and paste. They also tell you to download the API libraries. I did. The library has what looks like a common library directory with 10 or so DLLs (and various other files) and a separate folder with 45 folders for various "Services" and inside those more DLLs. And I am somehow supposed to know which DLLs this 20 line piece of source code needs??? So to be safe I end up including all the common libraries and both the libraries under the "DriveService". But the code won't compile. All the references are satisfied but now there's ambiguity between because an extension method is defined in two separate imported DLLs. It takes me another 20 minutes to figure out which one I don't need. Why do we have to go through all this??? It is all so utterly needless. I can't tell you how many times I've been unable to try out a piece of source code because something has gone wrong in figuring out and finding the libraries that were needed, and which versions of the libraries were needed (since libraries can radically change with every release).
What boggles the mind is that neither Visual Studio nor third-party VS plugins like ReSharper do anything to help. Surely something could be done to largely eliminate this problem! At the vary least, why couldn't they include a "header" like region at the top of the VS editor UI which lists the actual fulfilled references for that active file. It wouldn't actually be part of the source code, it would just be a handy little (perhaps collapsed) virtual piece of commented code that would be copied whenever you ctrl+a ctrl+c file contents. And when you pasted it elsewhere it would let people know what out-of-band files they were missing. The format would probably just specify the Portable Executable data for the file and the hash (not the actual path which would be less useful and less anonymous).
Here's hoping they do it one day, or someone makes a nice little third-party plugin that is able to sort it out for you (by having a massive DB of exported library functions and some good heuristics)...
^ Q
Copyright protected by Digiprove © 2013 Quinxy von BesiexRelated Posts
None
Bio
Related posts
None
Recent Posts
- Guide to Living a Highly Ineffective Life, Part I
- Spoofs Seem Less Funny When You See What They Were Spoofing
- The Immorality of Perpetuating Certain Dog Breeds
- The Infuriating C# Out-of-Code References
- Why Certificate Authorities are Stupid
- Google+ Hangout C# Control / WPF
- The New Kindle Scam : The High Cost of Paperless?
- “Be American! Buy American!” Says the Foreign-Born Mini-Mart Owner Selling Chinese Lighters, Drug Paraphernalia, and Porn
- Adding a Back Door to your Windows Computer via File Sharing
- Hate Windows 8? No, you don’t! You just need Start8 from Stardock!
Tags
Me, Elsewhere
My Other Interests
- Chang Jiang Collective
- League of Gentleman Riders
- Société Besiex de La Boîte Noire
- Vegetarian Dining Club
My Projects & Sites
Categories
- 3-D
- Apple
- Art
- Besiex
- Besiex & iCentric
- C#
- Charity
- Dogs
- DriverGuide
- humor
- iCentric
- Idea
- iPhone
- letter fragment
- Lifestyle
- Motorcycles
- Nook Color
- Observation
- Personal
- Photography
- poetry
- Politics
- Programming
- Prose
- Radio Controlled (R/C)
- religion
- Technology
- Thoughts
- Translations of Taras Zaitsev
- Uncategorized
- vegetarian