Solved: The destination thread no longer exists exception – C#

2016-11-08 You will get System.ComponentModel.InvalidAsynchronousStateException (The destination thread no longer exists.) if a UI component gets disposed or the UI thread EXITs while a different thread is in the middle of invoking a change on the same UI component. This usually happens when a user closes a window (form) that has been updated by aContinue reading “Solved: The destination thread no longer exists exception – C#”

Stop asp.net from encoding the source HTML string (mvc raw html)

/// Stops asp.net from encoding the source HTML string. public static IHtmlString HTMLRaw(string source) { return new HtmlString(source); } call this function whenever you want asp.net NOT to encode the string. Note: You can use <%= and %> tags to avoid encoding as well. Menol ILT

How to Add/Update/Remove Application Configuration (App.Config) Keys

14/05/2013 How to add new keys to app.config file? Simple, just use this code. When you execute this code, a new key will be added to your configuration file and the given value will be set for it. Important: This code will not change the configuration file you see in the Visual Studio but theContinue reading “How to Add/Update/Remove Application Configuration (App.Config) Keys”

Using Regular Expressions With Find And Replace In .Net IDE

06-06-2012 Use any regular expression to make your match. Then use {} pairs to define blocks of the search string you want to use in the Replaced string. Example: following find and replace strings will replace all occurrences ” report(number) ” to¬† ” // report – number ” in the following sample code. Sample CodeContinue reading “Using Regular Expressions With Find And Replace In .Net IDE”

File Reference vs. Project Reference in .NET

31-05-2012 File reference is when you add reference to a dll file. This is what you do when you have to use a 3rd party dll. The project reference is when you load a project into your solution and then add reference to it. Rather than adding a reference to its output dll file. ProjectContinue reading “File Reference vs. Project Reference in .NET”

Cannot Find Contents Of System.Configurations?

29-05-2012 The visual studio shows the System.Configurations namespace by default. But it doesn’t show that namespace content (such as System.Configuration.Configuration class) by default. You have to add a new reference to System.Configurations namespace explicitly. This is more confusing as it allows you to add using System.Configuration; in the class but then doesn’t show the contentsContinue reading “Cannot Find Contents Of System.Configurations?”

How to Save a Copy of a Visual Studio 2005 Solution

2008-12-22 Sometimes things we consider as simple take much time to be accomplished than we expect just because we forget! Today I wanted to save a copy of a web based visual studio 2005 solution but it took life 10 minutes for me to accomplish that because I had completely forgotten the method to doContinue reading “How to Save a Copy of a Visual Studio 2005 Solution”