.net

Modifying a non-local registry hive

I'm writing a program for my workplace and because we work on computers damaged by hard drives we sometimes need to work with their registries before they'll boot. Most notably, we're trying to fix the 0x7b error that stems from the Registry Hive that controls the default Hard disk drivers being damaged and the computer wont boot. Micr...

How to check whether one .NET type implements certain .NET interface abstractly?

Dear ladies and sirs. I have a type and an interface and I need to verify that the type implements the interface abstractly. I have set to write a brute force code using Reflection and it is pretty ugly. I am wondering if there is a better way than the brute force implementation I am doing now. Any ideas? Thanks. EDIT Have not che...

LINQ TO SQL am I missing something obvious here?

I have this method, that will be called against from a WCF Client, but for my testing, I'm uisng a local "add project reference." I'm getting the error that I cannot call the DataContext after it's disposed. public IEnumerable<Server> GetServers() { // initialze to null ServersDataContext sdc = null; try...

Why is 'http://dd ' a valid URL?

I'm writing a .NET 3.5 app and using URI.IsWellFormedUriString(string uriString, UriKind uriKind) to verify user-inputted URIs; using UriKind.Absolute. I was just playing with the application and I'm a bit worried and confused as to why something like: http://ddd is a valid URI? What gives? I know it's because it's part of the RFC, b...

differences between IoC containers

I'm looking for some guidance about how to chose an IoC container for an ASP.NET MVC application. What are the differences between (for example) StructureMap, Ninject, Castle Windsor, Unity, autofac and others? Can anyone give some hints or links to resource that might help chosing one library? Update: there is one question (http://sta...

WPF Setting Storyboard target in XAML

I currently have a set of buttons that I would like to set triggers so that each one will perform the same animation. Is there a way in XAML to 'pass' the target to the storyboard so that I don't have to rewrite the storyboard each time for each target? ...

WPF - DataTemplate without a container, items as rows in a Grid?

Is there an equivalent mechanism to the ItemsControl.ItemTemplate that works with a Grid? I have a collection of items and I'd like to present them as rows in a Grid so that I can assign Grid.Column to the individual elements inside the template (as opposed to rows in a list control). Is this possible in WPF using standard controls? ...

What is GenericParameterHelper and how is it used?

I generated unit tests on a generic class in VS 2008 and it used the type GenericParameterHelper in all of the places that a generic type was used. Is this a placeholder that should be replaced or does it have some use? What are the uses if any? Here's one of the tests it generated as an example: /// <summary> ///A test for Count ///</...

how to see stacktrace of.net application

Hi, I have a .net Windows application in the production that has no access to Visual Studio(standard edition), and the only thing they can install is the express edition, which does not have the Just-In-Time Debugging option (the one which has debug button when it crashes). So I was just wondering if there is a window application debug...

Determining when .NET is about to be loaded in (unmanaged) C++

[ this is getting TLDR...sorry... ] I work on a huge (mostly) C++/MFC application with hundreds of DLLs; it supports a dynamically-loaded "add in" mechanism via COM, thus add-ins can be developed in .NET by using COM interop. Some limited new functionality is developed in .NET w/o using this "add-in" mechanism (although still dynamicall...

Why aren't these WCF related resources cleaned up?

Here is my scenario: Start my test program and immediately break into the debugger (WinDBG) Take a !DumpHeap -stat and observe there are no System.Net* or System.Xml* objects anywhere Create my WCF client, make a WCF request Close the WCF client and force GC. Take a !DumpHeap -stat and observer there are tons of System.Net*, System.Xml...

Why System.Math has extern methods for Sin, Cos, etc?

[MethodImpl(MethodImplOptions.InternalCall)] public static extern double Sin(double a); What are the reasons for this? ...

How to break a context menu into more than one column in Winforms?

I have a ContextMenuStip that contains a dynamically generated list of ToolStripMenuItem objects. The problem is that when there are too many of them to fit onto the screen, tiny scroll buttons appear at the top and at the bottom of the list, and scrolling through the list is a bit tedious. How can I make the menu to automatically break...

.net 3.5 anonymous foreach

I'm trying to loop through the results of a function that is returning an anonymous object of results. public static object getLogoNav() { XDocument loaded = XDocument.Load(HttpContext.Current.Request.MapPath("~/App_Data/LOGO_NAV_LINKS.xml")); var query = from x in loaded.Elements().Elements() select new ...

Finding a control within a TabControl

All, I am attempting to find a control by name within a TabControl. However my current method does not drop down to the children of the control. What is the best way to do this Control control = m_TabControlBasicItems.Controls[controlName]; control is alway null because it is two (or three) levels below. TabPage, GroupBox, and someti...

Remote Debugging Fail - No suitable logon session

Receive this error message: Error while trying to run project: Unable to start debugging. Unable to start program "D:\xxx.exe". There appears to be no suitable logon session on the server. Please verify that you are logged on to the server through Terminal Services or that someone is logged into the server locally. This is the 1st ti...

[C# WPF] Accessing MainWindow Properties from other classes

I can modify/access controls and MessageBox with ease in the MainWindow.xaml.cs file of my WPF application. However, when I create some folders and add classes there, I no longer have access to MessageBox nor do I have see the control names in the Intellisense dropdown. (This seems quite elementary but I'm new to C# and WPF) ...

How can I use Linq to to determine if this string EndsWith a value (from a collection)?

Hi folks, i'm trying to find out if a string value EndsWith another string. This 'other string' are the values from a collection. I'm trying to do this as an extension method, for strings. eg. var collection = string[] { "ny", "er", "ty" }; "Johnny".EndsWith(collection); // returns true. "Fred".EndsWith(collection); // returns false. ...

Implement WinForms using WPF?

This question is a result of a lunch-time conversation with a co-worker...I've read questions like WPF vs. Winforms...and I personally think that long term WPF is the way to go. The problem/question is what to do in the meantime. Yes, WPF certainly has its advantages; not being built on GDI/USER is one of them. But at this point in ti...

How to identify exact the .NET Framework version installed with Service Pack and without Service pack in registry?

Hi Friends, I am facing a problem our application has been developed in .Net Framework 2.0 where it is getting crashed when we find the root in Microsoft help they suggested that .NET framework SP1and SP2 is not installed. In that SP's they have fixed the problem, now how should i found that which version Service Pack is installed in re...