.net

System.Net.ServicePointManager.DefaultConnectionLimit and .MaxServicePointIdleTime

When would you need to adjust these two settings (below)? And what do these two numbers mean for HttpWebRequests that I make? System.Net.ServicePointManager.DefaultConnectionLimit System.Net.ServicePointManager.MaxServicePointIdleTime Are ServicePoint objects specific to a domainname or each unique URI requested? ...

PNRP isn't starting and can't be found.

I'm trying to get a PNRP based C# application running but I can barely get started with it. Initially I had to download the .NET framework version 4 to get the correct references available to me. When the first call is made I get a "pnrp could not be started" exception. I tried to explore PNRP using netsh, but the command netsh p2p d...

Should I have a separate assembly for interfaces?

We currently have quite a few classes in a project, and each of those classes implement an interface, mostly for DI reasons. Now, my personal feeling is that these interfaces should be put into a separate namespace within the same assembly (so we have a MyCompany.CoolApp.DataAccess assembly, and within that there's an Interfaces namesp...

How do I read the data from a Photometric file.

I need to write a win application that would calculate the number of lights that would be needed based of some user inputs and an uploaded photometric file. Is there a component I can purchase for this to read the file data? Thanks ...

Code Contracts: Why are some invariants not considered outside the class?

Consider this immutable type: public class Settings { public string Path { get; private set; } [ContractInvariantMethod] private void ObjectInvariants() { Contract.Invariant(Path != null); } public Settings(string path) { Contract.Requires(path != null); Path = path; } } Two th...

.NET imagebutton - does it require codebehind?

Hi, I've created a simple .NET usercontrol for logging into a members area on a website (the site is powered by Umbraco and uses their membership provider). It worked fine until I changed the submit button on the log-in usercontrol to an imagebutton. Now it doesn't seem to submit anything - it just reloads the page when clicked and do...

Testing a .Net C# WPF MVVM application from an external application

Hi I have a largish application that uses MVVM. The Model is mostly in a C++ DLL. The ViewModel is in C#, and I've tied my WPF controls to the ViewModel in the usual way. The app is ready for integration testing. I can drive tests from within the application, but I'd like to move testing out into another process so I can minimize pollu...

What is the earliest entrypoint that the CLR calls before calling any method in an assembly?

In the past years I've occasionally been wondering what equivalent of the (in)famous DLL_PROCESS_ATTACH was available in the .NET world. Any documentation I have says, slightly simplified, that the earliest entry point to a class is the static constructor (cctor), but you cannot influence when it is called, nor can you define one cctor t...

WPF WebBrowser not including the hash in the source url ?

I'm currently trying to make a log in for facebook users into my WPF application. It's using .net 4 and it's being developed in VS2010. After following the steps stated in the facebook developers page I cannot get it working. The success url should be followed by a hash (#) and the access_token after the login, but webbrowser.Source.toSt...

preg_match to .NET equivalent

I have the following code in PHP: if (preg_match('@^[a-z0-9/._-]+$@i', $script) && !preg_match('@([.][.])|([.]/)|(//)@', $script)) I'm making the assumption that the predicate for the if statement returns true for the string js/core.js. How would I translate this to C#? The dumb translation is as follows: if(Regex.IsMatch(...

How to drop and recreate and primary key index using SMO with SQL Server?

I am using SQL Server 2005 Express. I want to use SMO to loop through each table in a database and change each Char column to a Varchar column. If a column is a member of the primary key, I need to first drop the primary key before altering the datatype of the column. Then I need to recreate the index. Here is the code I am trying to...

Prioritising Event Handlers

I have the following code where I am handling an event twice. However I always want to ensure that mynewclass always handles the event first and then the local event handler code fires. I understand the MyClass event should fire first as that is the one created first but because the thread and enqueuing is taking place, I think its tak...

What is the lowest impact method for profiling SQL Server for a specific client?

My local friendly DBA does not like the idea of allowing profiling on the SQL servers (even non-production ones) due to the impact on performance they have. Ironically, I'm trying to reduce the need for a whole bunch of SQL queries, and would like to be able to check in a fairly non-invasive manner what queries are being sent over the w...

Logging in with http to Xing

I have this code to log in to xing: class Programm { private static HttpWebRequest request; private static HttpWebResponse response; public static void Main() { //string targetUrl = "/app/forum/seoparser/bpmn/"; string requestUrl = "http://www.xing.com/app/user"; //Diese Parameter werden per Post...

Creating a database sandbox/testing area for users to run what-if scenarios

I'm trying to figure out how to create a "sandbox" area in my new Windows .NET/SQL Server application. Here's the requirements: Users must be able to enter their own data for things like date ranges and pricing Users must be able to run multiple scenarios against this pricing and date range data The data structures above will also be u...

C# Generic Methods, New Constraint

Hi, Is there a way to create a Generic Method that uses the new() Constraint and only accepts constructors of a given type? Example: I have the following code: public T MyGenericMethod<T>(MyClass c) where T : class { if (typeof(T).GetConstructor(new Type[] { typeof(MyClass) }) == null) { throw new ArgumentException("I...

OutOfMemory Exception when drawing cube

hi, i have a class that draws and rotates a cube. every time i rotate the cube i reload the buffer with the new values for the cube. public void LoadBuffer(GraphicsDevice graphicsDevice) { buffer = new VertexBuffer(graphicsDevice, VertexPositionNormalTexture.VertexDeclaration, triangles * 3, BufferUsage.None); bu...

GPL 2.0 Free Telerik Extensions for ASP.NET MVC

Is my ASP.NET MVC project automatically GPL 2.0 licensed by including these libraries? I always find this confusing with the GPL. ...

transfer change history from Subversion to TFS

I have a application in Subversion and I want to migrate it to TFS with all the history records. Is this possible? ...

Setting breakpoint in Windgb at System.IO.FileStream.Read() of mscorlib of .Net

I want to set a breakpoint for the System.IO.FileStream.Read() of mscorlib to trace when file reading occurs. I don't have the source code for the executable. I want to launch the trace from the entry point of MSIL code. ...