VS2013 .net application fails to run on Windows XP

Do you run into following error when trying to run a VS2013 .net application on Windows XP? Error: Not a valid Win32 application! This happens because the application is targeting .net framework 4.5 which is not supported on Windows XP. Target a lower framework to get your application working on XP.
Continue reading…

 

System.DateTime Custom Formatters

Problem Recently a customer opened a ticket thinking that there is an issue with the DateTime formatting function. They had the following piece of code. namespace DateTimeDefect{    class Test    {            static void Main(string[] args)            {                DateTime dt = DateTime.Now;                 Console.WriteLine(dt.ToString(“f”));                Console.WriteLine(dt.ToString(“ff”));                Console.WriteLine(dt.ToString(“fff”));                 Console.ReadLine();            }    }} Except for dt.ToString(“f”) the other two were returning […]
Continue reading…

 

A new look for .NET Reference Source

Just saw this… (totally cool) J http://referencesource.microsoft.com/ Channel nine video: http://channel9.msdn.com/Series/NET-Framework/How-to-browse-the-NET-Reference-Source Further details on our blog: http://blogs.msdn.com/b/dotnet/archive/2014/02/24/a-new-look-for-net-reference-source.aspx
Continue reading…

 

Error when application run from a network share: That assembly does not allow partially trusted callers!

Recently had a customer who faced this issue when his application is run from a network share. The exception information is as follows … ************** Exception Text ************** System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for dataConfiguration: That assembly does not allow partially trusted callers. (G:SystemBackofficeCitrix2008MediaExplorerRev2008ProdMfm.MediaExplorer.exe.Config line 28) —> System.Security.SecurityException: That assembly does […]
Continue reading…

 

Using Visual Basic PowerPack DataRepeater control in Visual Studio 2013

DataRepeater is great control to display data from a table/view, as the name says repeats bunch of fields from a dataset on every row. Follow these simple steps to get started working with this control… Step 1: Add a reference to the PowerPack library as shown here: http://ntcoder.com/bab/2013/12/20/visualbasic-powerpack-missing-from-visual-studio-2013/ Step 2: Make sure you’ve got the […]
Continue reading…

 

[Interop] Call into .net/managed code from native/unmanaged code

Introduction I’ve got a native console application which would like to call into a piece of managed code written in C#. This is the how the C# function “Sum” looks like… My solution explorer looks as follows… CSharpModule is a CSharp library while TestManagedCall is a native/unmanaged project. My requirement is as follows: call Class1.Sum […]
Continue reading…

 

Interesting read: Microsoft Intermediate Language (MSIL) instructions

Taken from MSDN: http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes_fields(v=vs.120).aspx  AddAdds two values and pushes the result onto the evaluation stack. Add_OvfAdds two integers, performs an overflow check, and pushes the result onto the evaluation stack. Add_Ovf_UnAdds two unsigned integer values, performs an overflow check, and pushes the result onto the evaluation stack. AndComputes the bitwise AND of two values and […]
Continue reading…

 

[.net] gcAllowVeryLargeObjects Element–beat the 2GB array size limit on 64 bit

Please note that this post is only applicable for .net 4.5 and above. Having trouble with .net array size limit, i.e. 2GB on a 64 bit target. Use above tag in your config file to work around this issue. A sample config file will look as follows… <configuration> <runtime> <gcallowverylargeobjects enabled=”true” /> </runtime> </configuration></pre> Please […]
Continue reading…

 

Difference between a class and struct in .net

Thought I will share some interesting differences between a .net class and a struct. Class Struct Allocated on the heap. Allocated on the stack. They are value types and don’t require heap allocation. A variable of a class type stores a reference to a dynamically allocated object. A variable of a struct type directly stores […]
Continue reading…