 |
|
 |
|
|
|
Debugging a hung WindowsForms app |
|
Andy's Blog
|
By Andy Beaulieu on
9/8/2005 11:51 AM
|
|
|
|
I've had to do this just a few times in the past several years, and I keep forgetting to blog it... but here goes. If you have a hanging issue in your application, it's easy to debug by attaching to the process through VS.NET. But what if the hanging only happens on a deployed machine without VS.NET installed? You can use cordbg.exe as follows...
- copy the below files from a developer's machine (with VS.NET or .NET SDK installed) to the machine with the issue msvcr71.dll msvcp71.dll msdis140.dll cordbg.exe.config cordbg.exe
- the user should have a hanging .NET app currently running. If not, have them run the app and recreate the problem.
- find the PID for the app by looking in task manager (you many need to add the PID column in to view it by selecting View/Select Columns from the menu)
- start cordbg.exe from a command prompt.
- attach to the .NET process... at the (cordbg) line, enter a {pid} where {pid} is the process id you found from task manager
- you can enter "sh" to show the source code lines of the current breakpoint.
- List the loaded modules in the process using the l mod command. The command line is shown below: (cordbg) l mod
- Display and examine the call stack trace for all current threads using the *w command. This should show what line the process is hanging on (assuming the PDB file is present for the hung assembly). Specify an argument of 200; this lists up to 200 levels of stack trace. (cordbg) *w 200
- Now detach from the process, and quit the debugger: (cordbg) de (cordbg) q
|
 |
|
Comments (0)
|
|
|
|
SpriteHand controls nominated for Awards |
|
Andy's Blog
|
By Andy Beaulieu on
7/28/2005 8:19 AM
|
|
|
Several of my SpriteHand controls have been nominated for Pocket PC Magazine "Best Software Awards 2005!"
ASprite.NET has been nominated for a 2005 Best Software Award in the ".NET Utility Libraries and Controls" category
AWaveCE has been nominated for a 2005 Best Software Award in the "Native Audio Libraries and Controls" category
ASpriteCE has been nominated for a 2005 Best Software Award in the "Native Graphic Libraries and Controls" category |
 |
|
 |
|
Comments (0)
|
|
|
|
|
|
Retrofitting a Website with DotNetNuke |
|
Andy's Blog
|
By Andy Beaulieu on
4/16/2005 7:20 PM
|
|
|
|
I've used Brinkster for hosting several websites on the cheap... and recently I wanted to take one of those sites and add DotNetNuke (DNN) on top of it, without converting any of the pages to DotNetNuke skins and tab pages.
What I did was rename the current site's Default.aspx to Default_MySite.aspx so that DNN's Default.aspx could take it's place. Then, I added a bit of code in DNN's Default.aspx to take care of rerouting any requests to “MySite”...
If Request.Url.AbsoluteUri.ToLower.IndexOf("mysite") <> -1 Then Response.Redirect("default_mysite.aspx") End If
After a quick check to be sure that none of DNN's project files had the same name as the existing site, I copied the remaining DotNetNuke files on top of the existing site, built, and released. I also needed to make a request to Brinkster Support to add privileges for the ASPNET Machine account to my webroot and all subdirs (as this is required by DotNetNuke). This retrofit allowed me to quickly add DNN to an existing Brinkster hosted account and still preserve the existing site.
|
 |
|
Comments (0)
|
|
|
|
Dynamic Images in Crystal Reports .NET |
|
Andy's Blog
|
By Andy Beaulieu on
1/27/2005 8:10 PM
|
|
|
|
You would think this is a simple task: let's say you have a Crystal Report and you want to dynamically change an image in the report by loading an image from disk. Well, as it turns out, this functionality is not available in CR for .NET!
But here is a work-around; Crystal for .NET does support displaying images from a DB. And it does support accepting a disconnected ADO DataSet as a data source. So you can trick Crystal into thinking it loaded an image from disk and presto, you have dynamic images from disk. Here's the process:
(1) Create an XSD file (you'll use this as your report data source in step 2) with a binary column definition like so:
<xs:element name="AnImage" type="xs:base64Binary" minOccurs="0" />
(2) Create your Crystal Report and use an ADO.NET (XML) DataSource as your Crystal Report Data Source.
(3) Fill your DataSet, and then set the binary “image” column to an image file from disk using a MemoryStream like so:
Dim oLogo As System.Drawing.Image Dim msX As New MemoryStream Dim dsReportSource As New DataSet ' TODO: Fill your DataSet, dsReportSource, with your Report Data
' Load your image from disk oLogo = oLogo.FromFile("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg") ' Save the image data to a Memory Stream oLogo.Save(msX, System.Drawing.Imaging.ImageFormat.Bmp) ' Set the binary "image" column in your DataSet to the image data (note dsReportSource is a typed DS here) dsReportSource.TestImage(0).AnImage = msX.GetBuffer
(4) Load your Crystal Report and assign the Data Source as usual:
Dim oRpt As New ReportDocument oRpt.Load("CrystalReport1.rpt") oRpt.SetDataSource(DsTestImage1) CrystalReportViewer1.ReportSource = oRpt
|
 |
|
Comments (6)
|
|
|
|
Streaming Crystal Output to a Browser |
|
Andy's Blog
|
By Andy Beaulieu on
12/14/2004 7:19 PM
|
|
|
|
This is a handy function that accepts an Export Format (i.e. PDF, Word or Excel) and streams a Crystal Report output back to the browser client.
Private Sub ExportReport(ByVal iFormatType As ExportFormatType) Dim sTargetPath As String, sTargetExt As String, sContentType As String Dim fs As FileStream Dim FileSize As Long Dim GenDS As DataSet Dim oRD As New ReportDocument() Dim crReportObject As ReportObject Dim oExO As ExportOptions Dim oExDo As New DiskFileDestinationOptions()
'Build Target Filename Select Case iFormatType Case ExportFormatType.Excel sTargetExt = ".xls" sContentType = "application/vnd.ms-excel" Case ExportFormatType.PortableDocFormat sTargetExt = ".pdf" sContentType = "application/pdf" Case ExportFormatType.WordForWindows sTargetExt = ".doc" sContentType = "application/msword"
End Select
sTargetPath = Server.MapPath("") & "\Export\" & Session.SessionID & sTargetExt
oRD = GetReportDocument() 'Export to PDF oExDo.DiskFileName = sTargetPath oExO = oRD.ExportOptions oExO.ExportDestinationType = ExportDestinationType.DiskFile oExO.ExportFormatType = iFormatType oExO.DestinationOptions = oExDo oRD.Export() oRD.Close()
'Send the file to the user that made the request Response.Clear() Response.Buffer = True Response.AddHeader("Content-Type", sContentType) Response.AddHeader("Content-Disposition", "file;filename=" & Left(ViewState("ReportName"), Len(ViewState("ReportName")) - 4) & sTargetExt) fs = New FileStream(sTargetPath, FileMode.Open) FileSize = fs.Length Dim bBuffer(CInt(FileSize)) As Byte fs.Read(bBuffer, 0, CInt(FileSize)) fs.Close()
Response.BinaryWrite(bBuffer) Response.Flush() Response.Close()
End Sub
|
 |
|
Comments (3)
|
|
|
|
|
|
|
 |
|
 |
|
|