.net

Designer serialization persistence problem in .NET, Windows Forms

ETA: I have a similar, smaller, problem here which, I suspect, is related to this problem. I have a class which has a readonly property that holds a collection of components (* not quite, see below). At design time, it's possible to select from the components on the design surface to add to the collection. (Think imagelist, but instead ...

Can IfxConnection and threading get along?

We have an application using the IBM Informix driver. Whenever we try to open connections in parallel, we start getting some really weird errors. This is the smallest reproduction code I could come up with: const int Count = 10; const string ConnectionString = "Host=the_host;Service=the_service;Server=the_server;Database=the_database;U...

Rhino Mocks DynamicMultiMock - setting expectation with return value on additional interface

Hello, I am creating a DynamicMultiMock as follows: this.serviceClient = this.mocks.DynamicMultiMock<ISlippyPlateProcedureService>(typeof(ICommunicationObject)); Then setting the following expectation: Expect.Call(((ICommunicationObject)this.serviceClient).State).Return(CommunicationState.Faulted); When I execute the test, Rhino M...

WCF Static Variable Getting Reset with Each Call

I have a WCF service that I am calling from multiple clients. I need to store and manage a value globally. On my service I have the following attributes: [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)] In my service I have something similar to this: private static int coun...

How do I get DirectorySearcher to honor my specified SearchScope?

I have the following C# code in a project: DirectoryEntry root = new DirectoryEntry(@"LDAP://ad.mydomain.com"); DirectorySearcher ds = new DirectorySearcher(root); ds.DerefAlias = DereferenceAlias.Always; ds.SearchScope = SearchScope.Subtree; ds.Filter = "(|(name=John_Smith)(cn=John_Smith))"; SearchResultCollecti...

Where did my Visual Studio exception assistant go?

Since a couple of weeks the Visual Studio (2008 9.0.30729.1 SP) Exception Assistant has stopt appearing while debugging using the C# IDE. Instead the old ugly and useless debug dialog comes up: To make sure, I've checked the following: "Tools / Options / Debugging / General / Enable the exception assistant" is on. "Debug / Exception...

How can I know if a file has been changed in .NET C#?

I have an application that requires a secure way to store its configuration. There are users that can change the configuration. I need some sort of signature scheme where I can verify that the config file has not changed with out a valid user. I had thought about using RSA, where the private key is encrypted with the users password, and ...

Long running stateful service in .NET

Hi, I need to create a service in .NET that maintains (inner) state in-memory, spawns multiple threads and is generally long-running. There are a lot options - Good-old Windows Service Windows Communication Services Windows Workflow Foundation I really don't know which to choose. Most of the functionality is in a library used by t...

How to do Python's zip in C#?

Python's zip function does the following: a = [1, 2, 3] b = [6, 7, 8] zipped = zip(a, b) result [[1, 6], [2, 7], [3, 8]] ...

C# - Getting a RawFraction Performance Counter to show a persistent value

I've created a performance counter that shows a fraction of an incremented value (RawFraction type) over a base value (RawBase). Unfortunately, when monitoring this value, it only shows the percentage when one of the counters is incremented. At all other times it it is sampled, it shows 0. Is there some way to tell the counter to hold ...

How to know if a C++/CLI reflected parameter is long or int?

I'm reflecting a C++/CLI method that has the following signature: void foo(long n); This translates into C# as: void foo(int modopt(IsLong) n); How can I find if an int parameter is actually a C++/CLI long by reflection? ...

WCF - Viewing xml request/response to a secure webservice

I have a WCF service application and in this app I am doing calls to a third party web service over a secure connection. I have been trying to view the request response streams using fiddler but I have given up on it after trying more than half day applying all I could find over the internet. It has a problem with certificates eventhoug...

How to clone objects in NHibernate?

How to implement cloning of objects (entities) in NHibernate? In the classes of entities has properties such public virtual IList<Club> Clubs { get; set; } All classes are inherited from BaseObject. I tried to implement using xml serialization, but the interfaces are not serialized. Thank you for your answers! ...

TCPClient in C# (Error).

using System; using System.Text; using System.IO; using System.Net.Sockets; namespace ConsoleApp01 { class Program { public static void Main(string[] args) { TcpClient client = new TcpClient("python.org",80); NetworkStream ns = client.GetStream(); StreamWriter sw...

ASP.NET Page Caching in a Web Farm

We have a small web farm(2 servers) balanced by the built in network load balancer in Windows 2003. We have a few pages that use page caching. My question is: Is it possible that that a given user could cause a page to be cached and another user see that content? Here is the page directive for the page in question: <%@ OutputCache D...

Page expiration after postback in ASP.NET

I've been doing web development for a while and have yet to read a good answer to this question: Given a page that executes transactions through a postback, how do you prevent the user from duplicating the transaction when they do something as simple as hit the back button? I've explored trying expire the cache but I must admit I'm l...

Any experience with CryptoObfuscator or CryptoLicensing?

Hi, I'm on the market for a good (and cheap) .Net obfuscator. I'm developing a .Net windows forms application. I evaluated IntelliLock and SmartAssebly so far. I quit the first on lack of support (I sent two emails with no response, no support site, etc). SmartAssebly looks pretty good but is too rich for my blood. Has anyone used C...

Problem with persisting a collection, that references an internal property, at design time in winforms, .net

(I've answered the question below with a hack. I'm fairly confident in it unless MS change the way that codedom serializers the designer code.) ETA2: I've worked out what is going on. I wondered why sometimes it would work and not others. It boils down to the name that I give to the internal property and the collection. If I rename th...

Creating a Desktop Shortcut Using a Web Page

I am trying to create something on a webpage that allows my users to create a desktop shortcut. Because my users are NOT technically savvy, I would like to avoid having them try to drag and drop. Is there a way that I could create a button on a webpage (either using JavaScript or .Net) that automatically creates a desktop shortcut for th...

Virtual microphone, networks and vb.net

I would like to add a virtual microphone (similar to how you can have a virual CD drive and then mount ISO files on it.) so that it can be selectable in programs like MSN and skype. But have the source of the audio be streamed from over a network(I know how to stream the audio over the network in VB.net) but how do I get that audio which...