.net

C#/CLR Remote debugger: how to wait until attached

Today I ran into a problem were I needed to remote-debug a program. The program was launched from another system, so I really don't have an opportunity to interact with it on the command line. I could change its source easily though. What I needed to happen was for the program to start normally, and then wait for me to attach to it wi...

C# Service cannot execute batch file?

I have a service that call a batch file sometime. The batch file take 5-10 seconds to be executed. The code to launch the batch file is : System.Diagnostics.Process proc = new System.Diagnostics.Process(); // Declare New Process proc.StartInfo.FileName = fileName; proc.StartInfo.WindowStyle...

Why does casting a null to a primitive(ie: int) in .net 2.0 throw a null ref exception and not a invalid cast exception?

I was going through some code and came across a scenario where my combobox has not been initialized yet. This is in .NET 2.0 and in the following code, this.cbRegion.SelectedValue is null. int id = (int)this.cbRegion.SelectedValue; This code threw a null reference exception instead of an invalid cast exception. I was wondering if an...

Best Free Controls for .NET

What Free Controls are there for .NET (both Winforms and Webforms)? ...

What are Generics in C#?

I'm trying to build my first generic list and have run into some problems. I understand the declaration looks like " List<T> ", and I have using System.Collections.Generic; at the top of my page. However, Visual Studio doesn't recognize the T variable. What am I missing? ...

"Thorough", tutorial on setting up Jetbrain's TeamCity CI server

Does anyone know where I can find a good tutorial to walk me through how to setup TeamCity CI server? I am new to unit testing and the agile philosophy of development so I could use some help getting my feet wet. I'm working with Asp.NET code using NUnit for my unit tests and would prefer a windows environment for the TeamCity server. Pl...

Silverlight enabled WCF Service vs Web Service vs ADO.NET Data Service

Ok, all these methods of getting data in a Silverlight control are confusing me. I've looked at ADO.Net Data Services, Web Service and Ailverlight-enabled WCF services. I'm just not sure when one is appropriate to use over another. What pros/cons do each offer? I've built a web app, and a silverlight control. I will be adding one of ...

How do you read an archived eventlog file?

Are there any libraries or resources available for parsing/reading an archived eventlogs? ...

Would this be a good case for polymorphism.

Sorry if this is a really basic question but I struggling with how I should attack this. I am trying to wrap up some commands for a OLE object, the basic spec looks like this: Set Window window_id //Units is part of the position setter. [ Position ( x, y ) [ Units paper_units ] ] [ Width win_width [ Units paper_units ] ] ...

.NET Event when laptop is going into suspend mode?

Is there anyway to get a handle to when a laptop is going into suspend mode and do something before it actually goes into suspend mode? I assume this is not easy/possible because it would be ill-advised for the power management to honor any such software that was trying to stop it from going into suspend mode. The specific use is to ...

Best crash reporting framework for .NET desktop applications?

I've got a couple simple Windows Forms apps that I'd like to add crash reporting to. Something that will give me info on what crashes are happening on user's machines (wrt my app, of course), including stack traces, logs, and screenshots, and a UI component for asking the user whether they want to upload it, etc. My apps are free, so I'd...

C++/CLI and the remoting security

Hi everyone, I have a c++/cli dll wrapping around some native code, and I'm trying to make an IPC server around this dll using the WellKnownServiceType. I wrote the entire thing in this fashion: Native code->C++/CLI dll->C# server program <---IPC link---> C# client I'm running into security problems when I do it this way: The client ...

What happens when WebClientProtocol Timeout occurs

Hi All, We have a client application that has reference to a webservice. We had set the timeout property on the webclientprotocol object to 50 (ms) and wanted to observe what goes on. We tied up a long running webmethod that returns a huge DataSet to the client. When the default value was there, the DataSet was returned properly to th...

How to Trace all local variables when an exception occurs

any generic way to trace/log values of all local variables when an exception occurs in a method? (in C# 3) ...

How many C# vs. VB developers are out there?

As a company it's important to choose which .NET language to go with. Many have chosen C# but are there any actual numbers out there to support going with C# over VB.NET? How many C# developers are out there vs. VB devs. I know that a good developer will be able to work with any language but the choice of language might dissuade a perso...

Render Excel File

Hi, I am actually rendering an excel file in the browser. I use the Response.Writefile(filePath) to dod this. It is working perfectly fine in few of the machines. I am getting a pop up with "Open","Save" and "Cancel" option. But incase of few machines after i do a save click on the popup a plain empty page remains open. This happens o...

WCF Socket Error 10045

My colleague has an app that hosts a simple WCF service with a net.tcp endpoint. I can add the service reference to any app I create using the address net.tcp://192.168.0.22:9999/GSS-POS/QueryDispatcher/mex However, when he tries to add the service reference to an app running on his machine he immediately gets a socket error 10045. We...

Using Process.Start() to start a process as a different user from within a Windows Service.

I'd like to periodically run an arbitrary .NET exe under a specified user account from a Windows Service. So far I've got my windows service running with logic to decide what the target process is, and when to run it. The target process is started in the following manner: The Windows Service is started using "administrator" credentia...

DataGridView, BindingList<T>, DataGridViewComboBoxColumn

Hello So, I have a DataGridView using as datasource a BindingList DataGridView.DataSource = new BindingList<Car>{...} Where public class Car { public ColorName Color { get; set;} } with public class ColorName { public int Id {get; set;} public string Name{get; set;} } and I use a Combobox column: DataGridViewCom...

Set a disabled TextBox's ForeColor to be the same as its BackColor in C#

How do I set a disabled TextBox's current text color to be the same as its current background color in C#? Simply doing txtLala.ForeColor = txtLala.BackColor does not seems to work. ...