"Fortunate are those who take the first steps.” ― Paulo Coelho

Languages features in C# 6 and VB 14

Feature Example C# VB
Auto-property initializers public int X { get; set; } = x; Added Exists
Getter-only auto-properties public int Y { get; } = y; Added Added
Ctor assignment to getter-only autoprops Y = 15 Added Added
Parameterless struct ctors Structure S : Sub New() : End Sub : End Structure Added Added
Using static members using System.Console; … Write(4); Added Exists
Dictionary initializer new JObject { [“x”] = 3, [“y”] = 7 } Added No
Await in catch/finally try … catch { await … } finally { await … } Added No
Exception filters catch(E e) if (e.Count > 5) { … } Added Exists
Partial modules Partial Module M1 N/A Added
Partial interfaces Partial Interface I1 Exists Added
Multiline string literals “Hello<newline>World” Exists Added
Year-first date literals Dim d = #2014-04-03# N/A Added
Line continuation comments Dim addrs = From c in Customers ‘ comment N/A Added
TypeOf IsNot If TypeOf x IsNot Customer Then … N/A Added
Expression-bodied members public double Dist => Sqrt(X * X + Y * Y); Added No
Null propagation customer?.Orders?[5]?.$price Added Added
String interpolation $”{p.First} {p.Last} is {p.Age} years old.” Added* Planned
nameof operator string s = nameof(Console.Write); Added* Planned
#pragma #Disable Warning BC40008 Added Added
Smart name resolution N/A Added
ReadWrite props can implement ReadOnly Exists Added
#region inside methods Exists Added
Overloads inferred from Overrides N/A Added
CObj in attributes Exists Added
CRef and parameter name Exists Added
Extension Add in collection initializers Added Exists
Improved overload resolution Added N/A

December 13, 2014 Posted by | Uncategorized | , | Leave a comment

Troubleshooting masterpiece by Mark Russinovich – Weekend Read. (from TechEd NA-2014)

It is always funny, geeky, informative and casual when listening to Mark Russinovich Tech-ed session. It made my weekend :)

Be sure to watch this – especially blue screen one.

Mark Russinovich.jpg

December 8, 2014 Posted by | .NET General, 100 % Fun...[really Worth] | | Leave a comment

How to create your first Office Com Addin

1) Create a C# class library project

2) Add Extensibility reference to the project
 namespace ClassLibrary1
 public class Class1 : Extensibility.IDTExtensibility2

3) Implement the interface method and place a messagebox OnStartupComplete to test
4) From Project properties > Build > "Register for COM interop"
5) From Project properties > Application > Assembly information > "Make assembly COM Visible
6) Compile - VS should automatically build and register the COM to the registry
7) This would create something like this,
 Windows Registry Editor Version 5.00
8) Now, create the below registry file "a.reg" save and run to create this entry under HCU
For Excel, create under Excel and accordingly for other product
 Windows Registry Editor Version 5.00
Copy "{0D39F056-DF63-3860-9E79-B57F6358FD4D}" and search under HKEY_CLASS_ROOT\CLSID
Windows Registry Editor Version 5.00
 [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0D39F056-DF63-3860-9E79-B57F6358FD4D}\Implemented Categories]
 [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0D39F056-DF63-3860-9E79-B57F6358FD4D}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}]
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0D39F056-DF63-3860-9E79-B57F6358FD4D}\InprocServer32] @="mscoree.dll"
 "Assembly"="ClassLibrary1, Version=, Culture=neutral, PublicKeyToken=null"
 "CodeBase"="file:///c:/users/maheshk/documents/visual studio 2013/Projects/ClassLibrary1/ClassLibrary1/bin/Debug/ClassLibrary1.dll"
 "Assembly"="ClassLibrary1, Version=, Culture=neutral, PublicKeyToken=null"
 "CodeBase"="file:///c:/users/maheshk/documents/visual studio 2013/Projects/ClassLibrary1/ClassLibrary1/bin/Debug/ClassLibrary1.dll"
9) Now launch, Excel should see the message box on load - means this add-in loaded because of load behavior set as "3" - load at start. ( at the step #8 )

10)You can check this, by Excel > File > Options > Addins > Active Application Addin: ClassLibrary1.Class, location: mscoree.dll, COM Add-in

11) Register: 
"%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /codebase ComAddin\bin\Debug\ComAddin.dll
"%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /unregister ComAddin\bin\Debug\ComAddin.dll

Note: You may get access denied if you did not run as VS in Admin mode. 

Refer -
Download my sample - 
Download C++ sample -

November 8, 2014 Posted by | .NET General, Office, Outlook | , | Leave a comment

How to capture the dumps when the application crash on launching ?

Two ways you can achieve this,

#1) Using Procdump

>procdump.exe -w -e -ma SomeCrashingApp.exe
[This command used to wait for the exe to appear, crash to gather the dumps ]

If you are capturing .NET 4.0 dump, then this won’t triggered, you may have to specify -e 1 to gather the dump for later framework.
>procdump.exe -w -e 1 -ma somecrashing.exe
If it is older version of .NET then you could use this.
>procdump.exe -w -e -ma somecrashing.exe

#2) Using DebugDiag

1 2 3 4

October 28, 2014 Posted by | .NET General | Leave a comment

About DDEInitialize and sometime lockup scenario explained.

I had a chance to work with Excel DDE call lockup Issue,

> The first step in establishing a DDE conversation is that the DDE client will send a WM_DDE_INITIATE message to one or more windows running on the same desktop as the DDE client process. The WM_DDE_INITIATE message is a query to each window receiving the message to determine whether the process that owns the window supports the specified application name and topic. Typically, a DDE client will broadcast the WM_DDE_INITIATE message to all top level windows (both visible and hidden) running on the same desktop, looking for any running process that supports the specified application name and topic.

The implementation of the Excel DDEInitiate function broadcasts the WM_DDE_INITIATE message by calling the SendMessage function, specifying HWND_BROADCAST. The SendMessage call will not return until each top level window has processed the WM_DDE_INITIATE message. The hang that occurs when calling DDEInitiate is the result of one or more threads that own a top level not having an active message pump.

The ListBlockedWindow tool helps to identify each process that contains  threads that do not have an active message pump and own one or more top level windows. The applications identified by the ListBlockedWindow tool should be updated such that each thread that owns a window has an active message pump, even when a given thread owns windows that are not visible. The term “message pump” (or message loop) refers to the calls a thread makes to the GetMessage or PeekMessage functions to retrieve/process any pending window messages for windows owned by the thread. A thread that owns a window receiving a WM_DDE_INITIATE message and does not actively call GetMessage or PeekMessage will cause the thread that is sending the WM_DDE_INITIATE message with SendMessage to block until the message is processed.

Please refer to the following links for additional information about DDE and message processing in Windows.

About Dynamic Data Exchange –

Using Messages and Message Queues –

SendMessage function –

Note: this content is not mine, borrowed from my colleague-DaveAnd

October 25, 2014 Posted by | .NET General, Office | Leave a comment

Fix: Open XML SDK hang in multithreaded environments

Just come to know through my colleague about this fix- wanted to share.
We finally have a fix for this long standing issue where applications using Open XML SDK (or System.IO.Packaging) would hang in multithreaded scenarios while working with large files.(10MB limit related bug).

Hotfix rollup 2996566 for the .NET Framework 4.5, 4.5.1, and 4.5.2 on Windows 8.1 and Windows Server 2012 R2
Hotfix rollup 2996567 for the .NET Framework 4.5, 4.5.1, and 4.5.2 on Windows 8 and Windows Server 2012
Hotfix rollup 2996568 for the .NET Framework 4.5, 4.5.1, and 4.5.2 on Vista SP2, Windows Server 2008 SP2, Windows 7 SP1, and Windows Server 2008 R2 SP1

src: Internal email

October 21, 2014 Posted by | Uncategorized | Leave a comment

Connect(); — Join this exciting virtual event for developers!







Connect(); is a cloud-first, mobile-first, code-first virtual event focused on current and future Microsoft technologies for developers. Build on your current skills, unleash your creativity, and expand what’s possible to deliver unprecedented innovations.

Want to ask and interact with Scott Guthrie, S. “Soma” Somasegar, Brian Harry, and Scott Hanselman & watch 40+ondemand vidoes?  

October 19, 2014 Posted by | .NET General | | Leave a comment

Convert PPT to SVG – workaround/hack !

One of my colleague wanted to know if there is any support from MS to convert the PPT’s to SVG without going through 3’rd party lib’s. I got an idea and jumped into connect the two different PIA’s to hack around. At the end, I am able to get it what he wanted. Good hacking :) – here is the poc of my sample tested roughly few times. You may have to fine tune or test thoroughly before moving to production.

Objective: PPT => SVG
Proposed idea: PPT (PIA) =>jpg => VISIO (PIA) => SVG.

  1. Create/open a PPT using Office.Interop.PowerPoint
  2. Save the PPT as Jpeg.
  3. Close the PPT
  1. Load a blank VISIO file using Office.Interop.Visio
  2. Import those exported Jpeg –from step2
  3. Export the document as SVG.

Here is the c# code.

using Office = Microsoft.Office.Core;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Visio = Microsoft.Office.Interop.Visio;

namespace ConsoleApplication1
class Program
static void Main(string[] args)



Console.Write(“Done.. Press any key to close”);
private static void CreatePowerPointUsingPIA()
PowerPoint.Application oPowerPoint = new PowerPoint.Application();

// By default PowerPoint is invisible, till you make it visible:
//oPowerPoint.Visible = Office.MsoTriState.msoFalse;

PowerPoint.Presentation oPre = oPowerPoint.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoTrue);

PowerPoint.Slide oSlide = oPre.Slides.Add(1,PowerPoint.PpSlideLayout.ppLayoutText);
oSlide.Shapes[1].TextFrame.TextRange.Text = “WELCOME : Win an Xbox One with Machine Learning!”;

oSlide = oPre.Slides.Add(2, PowerPoint.PpSlideLayout.ppLayoutText);
oSlide.Shapes[1].TextFrame.TextRange.Text = @”Conclusion: Thank you”;

string fileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + “\\SourcePPoint.pptx”;

catch (Exception ex)
Console.WriteLine(“PowerPoint throws the error: {0}”, ex.Message);
private static void CreateSVGfromJpegUsingVisio()
Visio.Application app = null;
Visio.Documents oDocs = null;
Visio.Document oDoc = null;

app = new Visio.Application();
app.Visible = false;

// Create an existing blank saved vsdx – dummy
string dummyInput = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + “\\Drawing1.vsdx”;

oDoc = app.Documents.Open(dummyInput);

//int DiagramServices = 0;
//DiagramServices = app.ActiveDocument.DiagramServicesEnabled;

string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

string[] filePaths = Directory.GetFiles(path + @”\SourcePPoint”, “*.jpg”);

int sliceCount = 1;

foreach (string str in filePaths)
app.Settings.SVGExportFormat = Visio.VisSVGExportFormat.visSVGExcludeVisioElements;
app.ActiveWindow.Selection.Export(path + sliceCount + “.svg”);
oDoc.Saved = true;
catch (Exception ex)
Console.WriteLine(“CreateSVGfromJpegUsingVisio throws the error: {0}”, ex.Message);
Let me know if this helps you or any correction required.

October 14, 2014 Posted by | Uncategorized | Leave a comment


If you would like to create spreadsheet-based mashups, then this is the site for you to start - 

To create an Excel mashup, you use Excel Web App to create an embedded workbook that is stored on SkyDrive, and then displayed in a host web page. Once you’ve embedded the workbook, you use the JavaScript API to programmatically interact with it.

  • Shows you how to embed a workbook on a web page.
  • Provides JavaScript code snippets.
  • Walks you through creating a web control.
  • Provides a demo that pulls it all together. 

October 4, 2014 Posted by | Uncategorized | Leave a comment

Did you try Bing Developer Assistant Beta ?

Bing Developer Assistant puts millions of code snippets and code sample projects at your fingertips while you are coding in Visual Studio.

I love this and really useful when I am looking for a sample beyond Visual studio auto intelisense. Current it is supported in VS 2012 & 2013. – Must try!!

September 26, 2014 Posted by | Uncategorized | Leave a comment

Clickonce installation error and resolution.

System.Runtime.InteropServices.COMException (0x800736B3): The referenced assembly is not installed on your system. (Exception from HRESULT: 0x800736B3)


Resolution:(Windows 8.1)
1. Navigate to the C:\Documents and Settings\<Profile Name>\Local Settings\Apps
2. Rename the Apps folder to AppsOld
3. Reinstall the ClickOnce application

September 25, 2014 Posted by | Uncategorized | Leave a comment

Cloud Design Patterns – Book Download

This guide contains twenty-four design patterns and ten related guidance topics that articulate the benefits of applying patterns by showing how each piece can fit into the big picture of cloud application architectures. It includes code samples and general advice on using each pattern.

September 22, 2014 Posted by | Uncategorized | Leave a comment

How to call C#.NET Class Library from Office VBA

1 2 3 4 5 6 7

August 23, 2014 Posted by | .NET General, Office, VBA | Leave a comment

ML : How to develop a mode, algo use and one liner explanation

Supervised Learning – Classification, Regression

Unsupervised Learning – Clustering, Recommendation


(1)Classification (Y/N/not sure, Maligant tumour or not)
Which customer are more likely to buy, stay, leave(churn analysis)
Which customer is going to get loans
Which transactions are fradulent
Which quotes are more likely to get executed

   What are the algorithms are there for Classification..
1.BCD (Boosted decision tree)
2.DF (Decision Forest)
3.DJ (Decision Jungle)
4.LR (Logistic Regression)

(2) Regression (Predictive analysis)
1. Stock price prediction
2. Market forecast
3. Weather forecast
4. Calculate insurance premiums based on different factors(feature)
5. Manpower prediction
6. Workload prediction
What are the algorithms are there for Regression..
1. Bayesian Linear
2. Linear Regression
3. Ordinal Regression
4. (BCD) ANN, Boosted Decision Tree
5. DF (Decision Forest)

(3) Cluster (Segmentation)
Divide a customer base into groups of individuals, age, market segmentation,
Data compression, color reduction, pattern recognition
             Which Algorithm to use..
1. K-means

(4) Recommendations (Product recommendation)

1. Amazon Recommender system
Algorithm: Matchbox

August 11, 2014 Posted by | Azure ML, MarketLearning | Leave a comment

Feature Exploration, Visualization and Predictive Modeling with R and AzureML

Iris Data Set
Needless to say, here is the master piece

Hats off to Raja Iqbal for this wonderful meetup session.


August 7, 2014 Posted by | Azure ML, Machine learnign | | Leave a comment

Partners Say New Azure Machine Learning Service Could Be Microsoft’s Secret Weapon In The Cloud

Microsoft earlier this month launched a preview of a new cloud service called Azure Machine Learning, and some partners are already using it to build the sort of apps that used to require a team of expensive data scientists to pull off.

August 4, 2014 Posted by | Azure ML, Machine learnign | , | Leave a comment

Office Click-to-run add-in supportability.

Even though the Office product runs in a self-contained environment, the Office product can interact with the other applications that are installed on the computer. Macros, in-document automation, and cross-Office product interoperability will work. Click-to-Run is also designed to allow locally-installed add-ins and dependent applications to work with it. However, there is the possibility that some add-ins or other integration points with Office might behave differently or might not work when you are using Click-to-Run.

 In-process, out-of-process, and hybrid add-ins

A key differentiator from a technical standpoint is whether the add-in is loaded in-process by an Office application or whether an out-of-process application is making a call into Office. 

Out-of-process add-ins/applications are stand-alone programs, scripts, or applications that use Office object model APIs to start functionality in the application and integrate with Office. In this case, the out-of-process application drives Office. Out-of-process applications are not supported in Click-to-Run.

In-process add-ins are loaded in-process by an Office application, and detected and opened by the application. Because of this, the Office application can use existing mechanisms, such as looking at specific registry keys or locations in the file system to discover all in-process add-ins. There is no such mechanism for out-of-process add-ins. Generally, in-process add-ins work with Click-to-Run. 

July 31, 2014 Posted by | Uncategorized | Leave a comment


Get every new post delivered to your Inbox.