.net

Where is mstest.exe located?

I need to run mstest from the command line - where in the world is this exe located? Can anyone give me a clue? Edit: I only have Visual Studio 2010 installed ...

Overriding and overridden methods must have same accessibility, so why isn’t same true for Page.CreateChildControls()?

Methods marked as virtual can be overridden in derived classes. One of the restrictions is that overriding and overridden methods must have same accessibility. Thus, if virtual method is marked as protected internal, then overriding method must also be marked as protected internal (it cannot be for example marked as just protected). Si...

Conditionally embedding a resource in Visual Studio (C#)

Is there a way to conditionally embed resources into a .NET project? I.e. if I have defined INCLUDETHIS then I want a certain large file embedded into the dll, otherwise I do not want it embedded. I know I can make two projects to do this, but I'm hoping to do it all in one project. The code that uses the file is easily conditioned with ...

How to Register a Type Library without RegAsm.exe

I want to know if it's possible to register a type library without using the RegAsm tool. Here is my situation, which will hopefully explain why I want to do this: I'm developing an assembly in .NET that will provide some modern functionality for our older VB6 applications. I have successfully registered the assembly and the type libr...

Determine Logical Line From Char Index (Winforms TextBox)

If I call textBox.GetLineFromCharIndex(int) in a TextBox with WordWrap = true, it returns the line index as the user sees it (wrapped lines count as multiple lines), not the line according to the line breaks. Line one extends to // <- word wrapped here. // <- logical line 1, GetLineFromCharIndex returns line 2 ...

.net How to store and retrieve exception.ToString() in a csv type file?

I've recently updated 1 logging component to log Exception.ToString rather than Exception.Message.ToString(), the problem I have with exceptions now are the following: Exception.ToString() contain line breaks and Can contain a tab character that I am splitting on Could cause other potential hurdles at run time, that I might not have t...

ByRef underlined with "Expression Expected" error in VB.Net when trying to pass in a object of type List(Of clsFooDetail)

I work with C# 99% of the time. However, I'm having to update some legacy VB.Net code and encountering an issue with VB.Net code syntax. The error that I get is "ByRef" is underlined and "Expected Expression" tag shows up when you hover over "ByRef". The "FooDetail.Load" function is written in C# and expects a List object passed as ref...

Visual Studio crashes when I debug a project with a certain form open in design mode..."Catastrophic failure"

As the title says, VS2008 keeps crashing on me whenever I debug a project when a certain form is open. I attached another VS2008 instance to it and found the following exception to be the culprit: System.Runtime.InteropServices.COMException occurred Message="Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))" ...

How should one deal with invalid business objects in code?

Lets say that you have a business object whose current state implies that there is some kind of a bug in your code. Or basically any scenario where you are working with your own data but it is in a state that should never occur violating some rules. I like to typically check for such conditions and assumptions because it allows me to c...

What does the exception "Exception from HRESULT: 0x80040653" when calling IFeatureClass.Search in ArcObjects mean?

I'm supporting an application built on ESRI ArcObjects where the original developers are long since gone. The application after having worked fine for a couple of years has started failing with this exception. The application runs on a daily schedule. The error message isn't very helpful. Any ideas what the cause of the error might be?...

How can I get useful WPF .NET error information from a user's machine?

Hi all, I have a WPF application that's crashing once I get it onto machines that do not have a development environment installed-- if this is a dupe, I'm welcome to closing, but I my search-fu is failing to find an equivalent question. It appears that I'm getting a XamlParseException, but nothing more useful than that. I need to get ...

Export GridView to Excel without losing grid lines in Excel

I have a GridView that I want to export to Excel. When I use the sample code I find online, it exports the content to Excel just fine, but for some reason it also clears out all grid lines outside of my exported table. For your average excel user this is easy enough to fix, but I need this solution to work for everyone. So then is ther...

SendMessage to .NET Console application

I have been experimenting with Sending Messages from 2 .NET Winform applications using WM_COPYDATA .. works great. What I would like to know is if that can be accomplished with Console applications. After all the SendMessage function takes in a window handle, so how can I get the window handle of a console application ? [DllImport("Us...

Seperating assemblies with web references

I am curious how others would handle this situation. I have a domain layer that includes an Address object. I then have an application that uses this object. Additionally, there is an asp.net asmx web service that performs address validation by going out to a third party web service. I am curious how to deal with this functionality. ...

Using Satellite assembly to replace UI in .NET application

At start of my WindowsForms/C#/.NET application, I'd like to load my satellite assembly and use it to replace the look-and-feel of my application. In a manner similar to how satellite assemblies are loaded for internationalizing an application. Except that I just want to be able to call something like: // Load it. Ignore CultureInfo, et...

Unexpected poor performance of SortedDictionary compared with Dictionary

I don't understand why the performance of SortedDictionary is approximately 5x slower than Dictionary for setting and retrieving values. I expected inserts and deletes to be slower but not updates or retrieves. I have tested .Net 3.5 and .Net 4.0 release compiled code. An array of random keys was pre-computed to ensure random variations ...

Measuring Class Dependencies

I want to measure dependencies between classes - what's the best approach and tools to use? I'm working in MS .Net Text based information / reports are OK, but I'd prefer something visual. Open source tool would be ideal. ...

Connection Pooling in .NET

I'm trying to create a Database object for myself in .net. The constructor takes a connection string and opens a connection to the MySQL db using the MySQL Connector. It has functions like: function executeNonQuery(cmd as String) as Boolean function getOneResultQuery(query as String) as String function getDataReader(query as String) ...

How do I create a generic overall .NET programming structure for my company?

I'm in a company that writes their own business data applications when there's no good off the shelf alternative. Most often it's - a login screen - some screens that are mostly visualizations of SQL Server tables - some reports In the past they've used MS Access. These are not exactly the most elite coders but they mostly get how ...

Why does .net interpret this date as the previous day when assigned to a date field?

I have a date I'm reading from an API in the following format: 2010-03-15T00:00:00-04:00 When assigned to a date datatype in C#/VB.net, it's displayed as: 3/14/2010 11:00:00 PM //Note 3/15 is being displayed as 3/14 why is this displayed as the previous day? Is there a name for the format above? ...