.net

Exception thrown when retrieving ODBC schema using .Net System.Data.ODBC

Our customer is using a driver by iWay Software to provide ODBC access to sequential files on a mainframe system. They are able to access the data successfully from Excel using the ODBC source but when we try to access the schema information using GetSchemaTable() on a successfully opened DbDataReader the following exception is thrown: ...

How to make application stop and run debugger?

I have .NET service and I need to debug it. I want it to stop when it reaches some place in code and start the debugger. Can anyone provide some code sample? UPDATE Simply adding Debugger.Launch(); does not work for Windows service. ...

Good books on .NET debugging

Hi, I'm looking for advice for books on .NET debugging, with an emphasis on topics such as debugging memory leaks, performance issues and so forth. So if you know a good book covering these topics, please drop an answer. Thanx! ...

How to specify a type parameter which does NOT implement a particular interface?

I have developed some extension methods for objects, which I don't want to be used/shown in intellisense for objects which implements IEnumerable. Conceptually I want something like as follows public static T SomeMethod<T>(this object value) where T != IEnumerable { } Is it possible to impose this kind of constraint a...

open multi image pages to different Bitmap objects in .net

I am developing an image editor and the structure needs a different Bitmap object for each page. But in .net i couldnt find a fine way. When i use Bitmap.Clone() it gives the same bitmap (not only one page) The code below works fine but its dirty and slow. So what would be the best way of opening a multi-image to separate Bitmap objec...

Visual Studio 2008 debugger detach

My Visual Studio debugger detaches every time when I try to access a property in a web application. I don't use Visual Studio's inner webserver, just the standard IIS. It seems like that property has somewhere a stack overflow (Server Application Unavailable) , but I can't find it. There is an error message in the EventLog: as...

Do native method reference have to be disposed - and if so are there any recommended practices to do so

I have a class which uses a method in user32.dll: [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern bool SetForegroundWindow(IntPtr windowHandlerPtr); According to Effective C#, should all classes which uses unmanaged code implement both IDisposable and a finalizer. Without going into the details in that d...

HttpWebRequest WebProxy problem - The connection was closed unexpectedly

I'm trying to make a HTTP request through an open SOCKS5 proxy. I have verified that the proxy works by setting it as a proxy for Firefox before setting it as the proxy in my C#.Net application by setting request.Proxy = new WebProxy(ip, port); However, on attempting to run the application and make my request I get an exception - System...

550 Requested action not taken: mailbox unavailable or not local

Hi all, Have set up a small website for a client however contact form submissions are not getting through to their email address. The bounce back has this message attached: 550 Requested action not taken: mailbox unavailable or not local It sends without issue to my email address and others but can't get to any on their domain. Cl...

Windows Mobile 6.1 - .NET CF StatusBar control - embedding icon

Hello Is it possible to embed an icon on StatusBar control on .NET CF 3.5? Regards Dominik ...

What are new feautures of .Net framework 4.0 for C# and windows form Application Developers?

I am c# developer ,i Like adapt myself for new technologies, so i eager to read about .Net framework 4.0, what are the new feautures of .Net Framework 4.0 especially for c#.Net and Windows form Application Developers and also i need some articles for improve my skills in that? ...

Is the return value of Interlocked.Exchange also processed atomically?

In the following code: a = Interlocked.Exchange(ref b, c); I know b is set to c atomically. But is a also set to b in the same atomic operation? Or is this outside of the atomic operation. What I need is to ensure both a and b are set in the same atomic operation. c => b, b => a This is in C#.Net. ...

Calling a stored procedure using LINQ to SQL with a Custom Entity Class

Hi Am trying to get linq to call a stored procedure. I know this is usually rather simple, but in this case i am using my own Custom Entity Classes and I am at a dead end. the link below will show you how I have my OM setup example does any one know how you can call a stored procedure from your own Custom Entity Class? EDIT: Forg...

problem when printing from web service

Hi, I have an application that needs to be able to print in different printers. This application has a desktop interface and a web service. If I try to print from the desktop application there is no problem, I'm able to print in both local and network printers, the problem is when I try to print via web service in a network printer (loca...

.NET Framework object that uses Dependency Injection?

i'm trying to find an example in .NET of a class that uses Dependancy Injection (e.g. a class that uses a Builder or Factory in order to create the full object - injecting dependencies as it does) Browsing through Reflector, i would have thought some of the more complicated ado.net or WebRequest objects would use dependency injection - ...

Windows Forms: User controls and events

I have a Windows Forms user control which consists of several controls. Among others there is also gridview control. Now I want to use the user control in a form. How can I check for example if a grid row is clicked? I want to get the data of the selected row. In other words, how can I detect events of the controls, which are embedded in...

Creating LINQ to SQL Record Properties that Point to Foreign Key Fields?

In my LINQ to SQL generated db class, I have a table with a foreign key reference to a field that has useful date information. A query might look something like this: var query = from a in db.TableA join b in TableB on a.FK_B_Id equals b.Id where b.Date.Value <= DateTime.Today select a; ...or more s...

How do I atomically swap 2 ints in C#?

What (if any) is the C# equivalent of the ASM command "XCHG". With that command, which imo is a genuine exchange (unlike Interlocked.Exchange), I could simply atomically swap two ints, which is what I am really trying to do. ...

Socks Proxy for HttpWebRequest

According to my research whilst trying to solve this problem, it turns out that the .Net WebProxy class does not support Socks proxies - a tad annoying. I also can't seem to find any code or information which explains how to implement Socks 4/5 support via a class which can easily be used with HttpWebRequest (the Proxy property, to be ex...

Dynamic routing problem when invoking site from remote host.

Hell, I have error handling for my mvc app configured in the simplified way below (globals.asax): protected void Application_Error(object sender, EventArgs e) { Exception exception = Server.GetLastError(); Response.Clear(); RouteData routeData = new RouteData(); routeData.Values.Add(...