Why I regret starting a complex project using .Net.
Microsoft continually has inconsistencies in their coding styles and duplicity or try to dumb down coding.
For example the HttpWebRequest class is a prime example of bad coding..
The class makes an assumption that Except header is to be set to a default value of "Expect100Continue". And of course I hunt and peck for a work around, http://haacked.com/archive/2004/05/15/http-web-request-expect-100-continue.aspx/.
Not all headers can be set via the Headers name / value collection but must be set via the class's property, such asAccept and Method but others such as Accept-Language must use the name / value collection. Name / value collection should accept any header name and value. Pointless requirements in how a class is setup.
Even the documented property of Connection, which states gets or sets the value in their documentation, is used for setting whereKepAlive property needs to used instead of the Connection property and theHeaders collection cannot be used either.
All of these assumptions of how good classes should be coded is making as ass out of coders and wasting time trying to find works arounds for basic logic faults on Microsoft's end.
One of the worst was find out that System.Windows.Media.MediaPlayer eventMediaEnded does not always trigger when the media file is finished playing. Had to write timer dispatch code as a work around in order to consistently have a working solution. This wasted time, but properly not as much as analyzing what is wrong with Microsoft's code and hoping it gets fixed..
The best show of how messed up .Net is by simply looking at this stack trace of a string parsing issue with-in a class, which is initiated by aWPFUserControl constructor. Issue only occurred during certain time of day and day of the week but not every week..
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[]) at System.Reflection.RuntimeMethodInfo.UnsafeInvoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at System.Delegate.DynamicInvokeImpl(System.Object[]) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at System.Windows.Application.Run(System.Windows.Window).
Only way I figured it out was simply thinking back to what I added recently. Stack trace above is completely useless..
Or having to create a Weak Pointer Event Manager instead of just removing thedelegate callback from the delegate list. Nothing like watching a program eat up 2 gigs of RAM in 72 hours..
Having to write code so the WPF designer doesn't start running internal code onUserControl(s) and crashing; preventing the designer from being used. That was another fun day of search why isVisual Studios acting up and not letting me design..
External libraries such as CURL keep on showing how more evolved they are. If I could go back a few months ago, I would of said no to .Net and yes to third party platform libraries.
Cannot wait for this project to be over!