.net

Extremely Weird Bug with a property in C#

I have a certain application which feeds information into an object, after comparing the new information to the old information. It goes something like set { oldval=_value; _value=value; if (some comparison logic) raiseEvent(); } This all happens on a background thread, in an infinite loop, which intermittently sleeps...

Is it possible to switch application configuration file at runtime for .NET application?

By default, .NET application's configuration file is named after "exe file name".config. I'm wondering whether it is possible to have one application's configuration specified dynamically. For example, the built application is "foo.exe". At runtime, the config file is "foo.exe.config". Is it possible to have it accept command line argum...

.NET Interop: Using an assembly in the current directory

I'm trying to use a .NET assembly from VB6 via interop without placing it in the GAC and without using the /codebase argument for regasm.exe. From what I understand, when I run regasm.exe on a .NET class library, it creates a registry entry for each class in the class library telling the COM clients they should load mscoree.dll that ser...

Table NewRow() Causes Memory Leak

Whilst investigating a memory leak I discovered that it was caused by calling NewRow() on a Table inside a loop many times. However the DataRow created was never added to the Table Rows collection and the Table Rows Count never got above zero. My question is why does this use up more memory every time NewRow is called even though the ne...

Is it possible to build an email reader for the Zune ?

Is it possible to build an email reader for the Zune through XNA ? Version 3.0 allows us to connect to the Market place and download music directly from the Zune hence the nature of my question. Edit: Buy a ZuneHD ...

What is the most secure hashing algorithm in the .NET framework?

The size of the generated hash and the speed of the algorithm are not important. I'm really only interested in it being the most secure option. I don't want to use any third party libraries either. The version of the .NET framework I'm using if 3.5 if that makes any difference. ...

Regex to match all words except a given list

I am trying to write a replacement regular expression to surround all words in quotes except the words AND, OR and NOT. I have tried the following for the match part of the expression: (?i)(?<word>[a-z0-9]+)(?<!and|not|or) and (?i)(?<word>[a-z0-9]+)(?!and|not|or) but neither work. The replacement expression is simple and current...

Is there any way to view all event handlers of TextBox TextChanged event in Visual Studio debugger?

When I add the textBox.TextChanged to watch list I get a message saying The event 'System.Windows.Forms.Control.TextChanged' can only appear on the left hand side of += or -= Is there any way to check what event's are called on text change? ...

Force application to shut down (.net)

Hi I'm looking to force my application to shut down, and return an Exit code. Had a look on MSDN and I can see that in WPF the Application has a Shutdown method which takes an error code as a parameter, but there doesn't appear to be one for System.Windows.Forms.Application. I can see Application.Exit() but not a way to pass back an e...

Error handling using Soap Headers

We are developing a new web service and are looking into the "best practice" for returning errors in the soap response. We were looking into creating a error response object which every response would contain as a property. This seems a little heavy however and are wondering if it is possible to use the SOAP header to carry this info...

moq - good sample apps

Hi guys I know that there has been a couple questions about tutorials on moq. But I am wondering if there are any sample apps out there that use moq in the context of an n-tier business application using ado.net. I find the tutes good, but they don't seem to bring everything all together into the big picture. Thus, I am looking for a s...

Effort Spent on Designing, Implementing and Maintaining CRUD.

Hi, What percentage of your total development effort do you spend on implementing and maintaining simple Create, Read, Update and Delete (CRUD) methods in your data access layer? Does moving to an ORM like Hibernate or Entity Framework lead to significant savings? Are there any design smells which let you know when moving to an ORM for...

Strongly Typed Resources Causing Problems?

In the middle of some refactoring and I've moved a resources file from one project to another. I think I clicked a warning telling me to Strongly type the resource file at one point and now I'm getting: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MyProject.Common.Resour...

How can I create EPS files in C#?

How can I create EPS files in C#? Are there any opensource libraries available or do I have to resort to the spec and do it by hand? ...

What is a strongly typed dataset?

What is a strongly typed dataset? (.net) ...

ASP.NET Session State Server - Saving Unserialized Data

As you know, in ASP.NET, you can store session data in one of following three modes: InProc Session State SQL Server For InProc mode, you can store any kind of data objects even it's not serializable. However, in Session State and SQL Server modes, you can only store serialized data. In my project, I have a ready made portal which...

How can I write a conditional lock in C#?

The thing is I've been using the lock statement to protect a critical part of my code, but now, I realize I could allow concurrent execution of that critical code is some conditions are met. Is there a way to condition the lock? ...

Can I fix the VS Debugger trying to connect to unconnected mapped drive.

When I have an unconnected mapped drive, the VSTS 2008 SP1 IDE debugger takes about 10 seconds to regain control. Needless to say single stepping is painful. Is there some setting to make this go away? I am debugging a mixed( C# / C++ / Web services ) program. More details: The program does not use the mapped drive at all. I use th...

ASP.NET UserControl Does Not Initialize Child Controls

Inside my page, I have the following: <aspe:UpdatePanel runat="server" ID="updatePanel"> <ContentTemplate> <local:KeywordSelector runat="server" ID="ksKeywords" /> </ContentTemplate> </aspe:UpdatePanel> The KeywordSelector control is a control I define in the same assembly and local is mapped to its namespace. The con...

Save PDF to A SQL Binary (.Net)

I am using a ASP/.Net webpage and i want to upload a pdf file into a SQL Database as a binary I am uping the build in upload control, can you please suggest a way of doing this. I also need to no how to read the pdf back and display it in a web browser. I will be using linq to upload and query my sql database. ...