Skip to content

Instantly share code, notes, and snippets.

@WinterAlexander
Last active December 3, 2021 03:58
Show Gist options
  • Select an option

  • Save WinterAlexander/26d3a28511eb4a158e47d877284e2364 to your computer and use it in GitHub Desktop.

Select an option

Save WinterAlexander/26d3a28511eb4a158e47d877284e2364 to your computer and use it in GitHub Desktop.
C# Wall of Hate
- Tooltips on listview items are shown only for first column (details mode)
- Can't center text of first column in listview (but can set a 0-width column)
- Can only put checkboxes on first column of a details listview
- Any control with an integrated scrollbar don't let us control it manually without showing it (gotta user user32.dll to sync textboxes)
- StringBuilder is sealed for no reason not letting people creating SQLRequestBuilder or HTMLBuilder classes efficiently
- RichTextBox is slow and accepting RTF only, flickers even when rendering disabled
- Designer doesn't accept having an abstract direct super class (gotta make everything virtual OR make a stand-in class)
- Listview disables checkboxes automatically when multi selecting elements without any option to disable this
- You need user32.dll to change a progress bar state (green, yellow or red) yellow meaning paused and red meaning error
- A progress bar can't be filled without it's animation (need to change the value twice and go backward) and it can't change it's value while not in the normal (green) state
- StreamReader and StreamWriter are buffered by default and there's no other class to read a file without buffering. If you don't want a buffered reading/writing write your own IO classes
- You need a special C#6 class to get the stack trace of an Inner Exception, rethrowing it will lose the stack trace
- Cannot execute a C# command line app from batch (it will execute in new window)
- Everything is "final" (not virtual) by default, not letting people override any method if the original programmer didn't explicitly think about it
- Linq's distinct method isn't accepting a lamdba (create your comparer in a different class)
- Can't prevent scrolling from text selection in a textbox (other than forcing a flickering rollback from user32.dll)
- On a details mode listview MouseClicks doesn't work if not hover an item
- Can't know what directory a Open/SaveFileDialog will open or has opened (can only set it) without playing in registry (and this key changes from XP to seven)
- Some custom collections (like ListView.SelectedIndexCollection) aren't IEnumerable<int> but IEnumerable only so lots of linq methods are missing. To use theses methods anyway, you have to make a useless cast col.Cast<int>() even if it's only containing integers
- Internal code for Winforms is based on native code not letting you see how it works at all
- Have to use reflection to remove unknown delegates from an event
- StringDictionnary isn't implementing IDictionnary nor ICollection (only IEnumerable without generic) so have fun with polymorphism
- Event delegates are null when empty forcing people to check for null everytime and warp the event into a local variable for thread safety. Workarounds are adding a empty delegate on event creation (which slowers the call), create an extension method (not always possible) or use the elvis operator (only C#6)
- In Visual Studio, backspace doesn't auto-unindent whitespaces
- In VS, you don't have example code to customize colors and the form to do that is modal
- Can't return what you want in property setter (but you can with a method setter)
- C# doesn't support return type covariance (annoying)
- Only good use case of the new keyword is a workaround to the unsupported return type covariance in c# (else if considered bad pratice)
- No digits separator nor binary literals
- Stack traces contains absolute paths, often resulting in lines like this: at Odotech.Odowatch.Controller.Install.Database.DBExecutePage.LogWritten(Object sender, OdoEventLogEntry e) in c:\Users\awinter\Documents\Visual Studio 2013\Projects\OdoWatchNewInstaller\Controller\Install\Database\DBExecutePage.cs:line 224
- Settings aren't mostly backward compatible, breaking your old settings when update
- Last statement in switch need a break
- On VS, Undo on the designer just reset it to the last saved version and there's no way to Redo
- Call of First or Single on Enumerable throws an exception on empty, so you have to check everytime
- On VS, running unit tests does not recompile edited code
- If a bad config file is present in .vs/ (hidden file), IIS will crash without warning in VS and menu to select navigator will crash without any warning
- No undo/redo on package explorer in VS
- Counting amount of elements of a enum is 100% retarded
- Since there's no wildcard on generics, your Map<String, GenericRepo<?>> becomes Dictionary<String, dymamic> and is way less readable
- Cannot create "Exception" namespace, leading to a conflit with the Exception class
- SerialPort is broken since 2010 and still not fixed in 2017, throwing random ass exceptions in Finalize and requires reflection and WinAPI calls to fix.
- Dumb ass comments in official .NET source code like "These are correct, but we'd have to fix PipeStream & NetworkStream very carefully."
- That: https://blogs.msdn.microsoft.com/shawnhar/2010/11/22/winforms-and-the-big-red-x-of-doom/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment