.net

Debugging a third-party DLL in Visual Studio.NET?

Hi, I am using a third party dll. For some particular cases the a function in dll is throwing an exception. I want to know whether it is possible to debug the dll in the visual studio ? Update After the answer from Andrew Rollings , I am able to view the code, but I is there any easy way to debug through the code in visual studio....

Extracting equations and images from Word

Is there a programmatic way to extract equations (and possibly images) from an MS Word document? I've googled all over, but have yet to find anything that I can sink my teeth into and work from. If possible, I'd like to be able to do this with VB.NET or C#, but I can pick up enough of any language to hack out a DLL. Thanks! EDIT: Rig...

Setting WPF image source in code

I'm trying to set a WPF image's source in code. The image is embedded as a resource in the project. By looking at examples I've come up with the below code. For some reason it doesn't work - the image does not show up. By debugging I can see that the stream contains the image data. So what's wrong? Assembly asm = Assembly.GetExecuting...

How do you dispose of an IDisposable in Managed C++

I'm trying to Dispose of an IDisposable object(FileStream^ fs) in managed C++ (.Net 2.0) and am getting the error 'Dispose' : is not a member of 'System::IO::FileStream' It says that I should invoke the destructor instead. Will calling fs->~FileStream(); call the dispose method on the FileStream object? Why can't I call Dispose? ...

RegEx for extracting HTML Image properties

I need a RegEx pattern for extracting all the properties of an image tag. As we all know, there are lots of malformed HTML out there, so the pattern has to cover those possibilities. I was looking at this solution http://stackoverflow.com/questions/138313/how-to-extract-img-src-title-and-alt-from-html-using-php but it didn't quite get ...

Process start and Impersonation

I have problem with starting processes in impersonated context in ASP.NET 2.0. I am starting new Process in my web service code. IIS 5.1, .NET 2.0 [WebMethod] public string HelloWorld() { string path = @"C:\KB\GetWindowUser.exe"; ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = Path.GetDirec...

ASP.NET ViewState postback with page refresh and bookmarks

The ASP.NET ViewState feature can sometimes be a double edged sword. I rely on it on most of my projects and it speeds up development considerably. My problem is that sometimes users will try to refresh a page which will cause the viewstate to be lost, other times the user might want to bookmark a page but when the get back the viewstat...

"List Injection" in Unity?

I've got a project coming up that will involve connecting to one to many backend systems through the same interface; let's call it IBacksideProvider. I'd like to use Unity to inject these providers at runtime. The problem is that since we're talking about 1...n backend systems, I'd need to register 1...n implementations of IBacksideP...

How can I generate GIF images in .NET?

Is there a .NET library I can use to programmatically generate my own GIF images? At a minimum I'd like to build it pixel-by-pixel. Better would be support for text and shapes. Here's an example of what I'm trying to do. I mocked this up in Photoshop What do you recommend? ...

Deploy an app.config based on build configuration

I have three custom build configurations { Dev, Qs, Prd }. So, I have three app configs { Dev.config, Qs.config, Prd.config }. I know how to edit the .csproj file to output the correct one based on the current build configuration. <Target Name="AfterBuild"> <Delete Files="$(TargetDir)$(TargetFileName).config" /> <Copy SourceFiles=...

CodeRush Tricks of the Trade

I was using CodeRush quite while ago and now I'm planning to use it again. I've installed the trial but I forgot all the cool features except Alt + Home (drop a marker). And when you don't know some cool tricks it's really like burning money (since it's not cheap for personal use). What do you like about it? What are your best features?...

Looking for a better way to change parent form's size ...

I've got a simple application that shows pictures dragged onto it. I'd like the application to resize itself according to the picture it displays. The code below does just that: // Load the picture Bitmap picture = new Bitmap(s); // Calculate the size of the main form this.Size = new Size(picture.Width + (this...

Initialize a collection within an object?

If an object has a property that is a collection, should the object create the collection object or make a consumer check for null? I know the consumer should not assume, just wondering if most people create the collection object if it is never added to. ...

IdbConnection vs. SqlConnection

When I write an app, I use the System.Data interfaces (IDbConnection, IDbCommand, IDataReader, IDbDataParameter, etc...). I do this to reduce vendor dependencies. Unless, I'm doing a simple test app, it just seems like the ethical thing to do when consulting. However, it seems like all the code I see uses the System.Data.SqlClient nam...

Book about .Net Compact Framework development

Hello, I'm searching for a book about developing with .Net Compact Framework. Does anybody have any hints? Thanks. Yours, Thomas ...

How do I view 'raw' PNG image data ...

I'm trying to write an application that converts 48 bit-per-pixel PNG files to a proprietary (Bayer) format. The code (courtesy here) below works great for some PNG file formats, but when I try a bona fide 48 bit PNG the code throws an exception - is there an alternative? static public byte[] BitmapDataFromBitmap(Bitmap objBitmap...

Google Base Query Problems

I am querying Google Base using the .NET library pretty much as described on this page. http://code.google.com/apis/base/docs/2.0/developers_guide_dotnet.html When I run the query a GBaseFeed is returned and it will usually have the TotalRecords property set to something like 35, but in the Entries collection it will often have no item...

C# Extension Method Oddity during Unit Test

Using Visual Studio 2008 / C# / VS Unit Testing. I have a very straightforward extension method, that will tell me if an object is of a specific type: public static bool IsTypeOf<T, O>(this T item, O other) { if (!(item.GetType() is O)) return false; else return true; } It would be called like: Hashtable myHa...

Disabling redraw in WinForms app

I'm working on a C#.Net application which has a somewhat annoying bug in it. The main window has a number of tabs, each of which has a grid on it. When switching from one tab to another, or selecting a different row in a grid, it does some background processing, and during this the menu flickers as it's redrawn (File, Help, etc menu item...

Where can I find a list of SocketErrorCode and NativeErrorCode thrown by SocketException?

Hi, A SocketException has a SocketErrorCode and NativeErrorCode. I would like to find a list where these codes (or the common onces) are listed so I can respond in proper fasion. Does anybody know where to find such a list? ...