Good: there’s a Visual Studio extension that allows you to bind F1 (or another shortcut) to “open a new browser and search for the currently highlighted text”. Saves me at least 24 keystrokes per day, or over 100k keystrokes before I get to retire.
Bad: sometimes you get an exception that looks extremely self-explanatory, but the obvious solution, nor any of the search result web pages seems to solve your issue.
Even worse: had three of those in one day. I thought I would save someone else some trouble some day, and post about these three ‘self-explanatory’ exceptions, and explain what the description really meant to me.
OutOfMemoryException: Out of memory.
[OutOfMemoryException: Out of memory.] System.Drawing.Graphics.FromHdcInternal(IntPtr hdc) +1151157 System.Drawing.Font.ToLogFont(Object logFont) +145 System.Drawing.Font.ToHfont() +98 Telerik.Reporting.Pdf.Fonts.TrueType.FontReader.GetFontData(Font font, Boolean& isTTC) +101
What is seems to mean: “You are out of memory. Consider scaling out.”
What it really meant in my case: “You are trying to run a Telerik report or another operation that requires GDI+ from an Azure Web Site. Azure Web Sites do not support GDI+. Consider deploying to an Azure Cloud Service instead, or… Ah, screw it, this exception message is too long, let me just throw you an out of memory exception instead.”
What I did: deployed to an Azure Cloud Service. Sent the bill to Telerik. No response yet.
Unable to find any implementation of the contract: ‘Microsoft.LightSwitch.BaseServices.Logging.Internal.ILoggingService’
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information. 1) Unable to find any implementation of the contract: 'Microsoft.LightSwitch.BaseServices.Logging.Internal.ILoggingService'
What is seems to mean: “Your IOC container, MEF, is missing an implementation of the ILoggingService.”
What it really meant in my case: “You tried to instantiate a ServerApplicationContext, but something went wrong. Whatever went wrong will be logged, let me just get a logger from the MEF container that is created when you instantiate a ServerApplicationContext. Oooo crap”.
What I did: found that some of my ServerApplicationContexts wasn’t properly being disposed of. Always wrap your IDisposables in a using statement.
System.Security.SecurityException: Dialogs must be user-initiated
What is seems to mean: “You are trying to show a Print/Save/Open dialog from a sandboxed Silverlight application, but the user asked for no such thing.”
What it really meant in my case: “You are trying to show a Print/Save/Open dialog from a sandboxed Silverlight application, and the user did just click a Print/Save/Open button. However, somewhere deeply buried in MSDN documentation it says that between the user instantiated event and the point where you show a dialog, there can only be a very limited amount of time. The length of this time limit isn’t specified in an absolute number of milliseconds, but as ‘the number of milliseconds you really need, minus 5‘.”
What I did: removed all breakpoints, and split up the processing of the report and the actual printing in a two-step process. This way, when the report is fully rendered, the user has to click a button “ok well print it then” which only invokes the actual print dialog.
Your turn, Dr. Watson.