Cyberiafreak

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

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

Advertisements

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 – http://msdn.microsoft.com/en-us/library/windows/desktop/ms648774(v=vs.85).aspx

Using Messages and Message Queues – http://msdn.microsoft.com/en-us/library/windows/desktop/ms644928(v=vs.85).aspx

SendMessage function – http://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx

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
http://support.microsoft.com/kb/2996566
Hotfix rollup 2996567 for the .NET Framework 4.5, 4.5.1, and 4.5.2 on Windows 8 and Windows Server 2012
http://support.microsoft.com/kb/2996567
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
http://support.microsoft.com/kb/2996568

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?  http://www.visualstudio.com/connect-event-vs  

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)
{
CreatePowerPointUsingPIA();
CreateSVGfromJpegUsingVisio();

GC.Collect();
GC.WaitForPendingFinalizers();

GC.Collect();
GC.WaitForPendingFinalizers();

Console.Write(“Done.. Press any key to close”);
Console.ReadLine();
}
private static void CreatePowerPointUsingPIA()
{
try
{
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”;
oPre.SaveAs(fileName,PowerPoint.PpSaveAsFileType.ppSaveAsJPG,
Office.MsoTriState.msoTriStateMixed);

oPre.Close();
oPowerPoint.Quit();
}
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;

try
{
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.ActiveWindow.Page.Import(str);
app.Settings.SVGExportFormat = Visio.VisSVGExportFormat.visSVGExcludeVisioElements;
app.ActiveWindow.Selection.DeselectAll();
app.ActiveWindow.SelectAll();
app.ActiveWindow.Selection.Export(path + sliceCount + “.svg”);
sliceCount++;
}
oDoc.Saved = true;
oDoc.Close();
app.Quit();
}
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

About ExcelMashup.com

If you would like to create spreadsheet-based mashups, then this is the site for you to start –http://www.excelmashup.com/ 

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.

http://www.excelmashup.com/ 

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

   

%d bloggers like this: