.net

TypeInitializationException when running mstest from command line

We have a subset of unit tests which until recently have always been run through Visual Studio. I am now working on a continuous integration setup which will run the tests. All of the tests pass when run through Visual Studio but when I attempt to run them from the command line using mstest they fail with a "TypeInitializationException...

WCF soap service - add http headers

I and consuming a soap web service using the Service Reference interface in visual studio. The service requires that I include some http headers in the request for authentication. How can I go about adding http headers to the request is the webrequest exposed at some point in the process? ...

Get .NET thread type?

From my current process in .NET I can get a list of all its threads. Is it possible to find out what kind of thread it is? To get details if it's for example a worker, IO, CLR, backgroud or main thread? ...

SelectGroupByInto is not grouping!

Hi people. I'm trying to use this implementation of a DataSetHelper to group a DataSet by a column. What I'm doing is: DataSet ds_tmp = new DataSet(); DataTable dt_tmp; ds_tmp.Tables.Add(data_table_UserTime); dsHelper = new DataSetHelper(ref ds_tmp); dt_tmp = dsHelper.SelectGroupByInto("UniqueUsers", ds_tmp.Tables[0], "User, sum(Time) ...

Best practice for User Control Data Binding - How to achieve this?

Hi folks, I've got an User Control with TextBoxes, Labels, ... . Now I would like to get the same Data Binding Features like I would place the Controls directly on the Form. I tried with an extra Binding Source and Error Provider in the User Control and I tried to make the Properties of my Controls available as an property. Nothing wor...

timer application for cyber cafe.How to lock window after 1 hr session?

I am creating one application for a cyber cafe.I just have to create one exe file that I'll run on each system of cafe.Requirement is a small timer window, a customer can only be able to surf internet when he/she clicks start timer button.one timer session is set for 1 hr.when 1 hr is over it will lock the window and again customer will...

All Strings to resource

Hi I'm Looking For a tool that help me to extract all strings of my code files to Resource File. I Used Coderush and Microsoft add on(resourcerefactoring.codeplex.com) for working with Resource files. but i had to extract strings to resources one by one. Is there any better option? ...

Need help using C# FindControl

I have a repeater inside a panel. Inside this repeater I have another panel.Upon certain conditions, I want to set this panel.visibility = false. In the code behind, I try locating the panels on OnItemDataBound and set visible=false. But it only returns Object reference not set to an instance of an object.. I guesing it's because it ca...

A question about AlphaBeta algorithim

Hello everybody. I have experienced AlphaBeta algorithm with my own old chess engine and now i am trying to write new engine and i see that algorithim encounter beta cut-offs but in my opinion, this should never be occur if i don't use narrowed window. Am i wrong ? I am using int.MaxValue for beta and -int.MaxValue for alpha so what ca...

Can we execute a batch file (*.bat) using Application Domain?

Can we execute a batch file (*.bat) using Application Domain? Thank you in advance. ...

Using the C# Volatile keyword in Threaded Application

I have a class that has a few arraylists in it. My main class creates a new instance of this class. My main class has at least 2 threads adding and removing from my class with the arraylists in it. At the moment everything is running fine but I was just wondering if it would be safer to declare my class with the arraylists in it as vol...

Show hidden window

I'm creating child console application using Process.Start method. Process is created with WindowStyle set to ProcessWindowStyle.Hidden. But then I need to SendInput to this window and try to show it using ShowWindow method. But ShowWindows has no effect. ...

Silverlight ScrollViewer or HorizontalScrollBar

I have ScrollViewer and child Stack panel. I need my HorizontalScrollBar automatically scroll right when content added. How to do this? Items to stack panel added dynamically. P.s. i am trying to use this.scrollViewer.ScrollToRight(); but it not always scrolls to end. ...

Is .NET Socket Send()/Receive() thread-safe?

Since a socket is full duplexed, meaning you can send and recieve simultaneously. So, is the .NET Socket Send()/Receive() thread-safe? I need to Send() and Receive() in 2 threads. ...

Debug C# webservice client

I ran into a strange problem using a C# webservice client to call a ASP.NET 2.0 webservice. The service is a simple product search and returns an array of products matching a search term - see the relevant part of the WSDL file below. My C# client is simply generated by adding a web reference in VS2010 (non-WCF) and for comparison I'm us...

Which .NET SHA1 class is FIPS compliant?

I'm using the SHA1Managed class in my code, but this causes a problem when I run it on a particular machine. I get this exception: System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms. The problem is caused by SHA1Managed, which is not FIPS compliant. ...

What is a correct approach to register several inctances for the same type in Windsor Container?

I am using CommonSrviceLocator with WindworContainer for resolving my NHibernage.ISession instances. ISession instances is created through SessionFactory. For some reason I need to work with different databases in one application, so I need different connection strings and different NHibernate.ISession objects. SessionFactory can create...

.Net Remoting not working in Windows 7

We have a server application (developed using .Net 1.1, C#) which listen the port 8086 and the client application, before starting will handshake with this server using remoting. The application is working fine in almost all environments - Windows 2000/2003/2008/XP/Vista. Now we are facing an issue with Windows 7. When we are starin...

System.IO.IOException in PresentationFramework.dll on instantiation of a user control in WPF

I have a user control UserControl which is in an assembly Assembly. I have a WPF application which instantiates UserControl in a programmatic way. I have already added a reference to Assembly. However, during runtime I get the ff. exception: Cannot locate resource 'usercontrol.xaml'. at MS.Internal.AppModel.ResourcePart.GetStreamC...

Using control.Visible returns False if it's on a tab page that is not selected

Hi, I have a form with 2 tab controls. Form opens on tab 1. I have a few controls I need to validate on tab2. If the controls I want to validate have been set to not Visible then I want to ignore validation. (i.e. The controls have been hidden from the user) Problem is all the controls on tab 2 return Visible=False, because the Tab is ...