.net

How to solve the performance decay of a VB.NET 1.1 application?

I have single-thread windows form application written with VB.NET and targeting Framework 1.1. The software communicates with external boards through a serial interface, and it mainly consist of a state machine that run some tests, driven in a loop done with a Timer and an Interval of 50ms. The feedback on the user interface is done thr...

ASP.NET MVC: View does not get rendered with updated model value

I'm experiencing the a challenge in populating the child records. My previous code was like - <%= Html.TextBox("DyeOrder.Summary[" + i + "].Ratio", Model.DyeOrder.Summary[i].Ratio.ToString("#0.00"), ratioProperties) %> This code does not render the updated values after post back. To resolve this issue my work around was like - <%=...

How to Perform Continues Iteration over Shared Dictionary in Multi-threaded Environment

Dear Gurus. Note Pls do not tell me regarding alternative to custom session, Pls answer only relative to the Pattern Scenario I have Done Custom Session Management in my application(WCF Service) for this I have a Dictionary shared to all thread. When a specific function Gets called I add a New Session and Issue SessionId to the clien...

Is the Microsoft Enterprise Library Data Access Application Block thread safe?

I can't seem to find any documentation regarding thread safety... In particular - is the Database class (and subclasses) thread safe How would I find this out for myself? Are there references to thread safety for classes on the MSDN site? ...

How to refactor models without breaking WPF views?

I've just started learning WPF and like the power of databinding it presents; that is ignoring the complexity and confusion for a noob. My concern is how do you safely refactor your models/viewmodels without breaking the views that use them? Take the following snippet of a view for example: <Grid> <ListView ItemsSource="{Binding C...

WCF throws IOException while read and deserialize object

The application is implemented using WCF and NHibernate The problem arises when you try to retrieve an array of objects in the stream. The error occurs not always and only on certain sites. Service Config <system.serviceModel> <bindings> <basicHttpBinding> <binding name="ServiceHttpBinding" closeTimeout="00:05:00" openTim...

Winforms panel event after scroll

Hello I have a panel in wich I do a bounch af rater complex drawing in the paint event. Since the drawing-code is kind of heavy, it gets rather twitchy when I scroll the panel, since the paint event is raised in such short intervals. My question is really this; Can i capture evnts such as "on scroll start" and "on scroll end" on a winf...

Does this keyword exist? When an overriding method needs to call the parent

Often, in C# documentation, you come across a member where the description says something along the lines of "be sure to call the base method if you override this." Is there a way to ensure at compile time that one has actually called the base function? Here's an example: Implementing a Dispose Method From the first lines: A type'...

C# compiler fails to recognize a class is implementing an interface

The following code fails to compile (using VS2010) and I don't see why. The compiler should be able to infer that List<TestClass> is 'compatible' (sorry for lack of a better word) with IEnumerable<ITest>, but somehow it doesn't. What am I missing here? interface ITest { void Test(); } class TestClass : ITest { public void Te...

Can I encrypt web.config with a custom protection provider who's assembly is not in the GAC?

I have written a custom protected configuration provider for my web.config. When I try to encrypt my web.config with it I get the following error from aspnet_iisreg aspnet_regiis.exe -pef appSettings . -prov CustomProvider (This is running in my MSBuild) Could not load file or assembly 'MyCustomProviderNamespace' or one of its ...

Literal ampersands in System.Uri query string

I'm working on a client app that uses a restful service to look up companies by name. It's important that I'm able to include literal ampersands in my queries since this character is quite common in company names. However whenever I pass %26 (the URI escaped ampersand character) to System.Uri, it converts it back to a regular ampersand ...

Detect variance on generic type parameters of interfaces

Is there a way to reflect on an interface to detect variance on its generic type parameters and return types? In other words, can I use reflection to differentiate between the two interfaces: interface IVariant<out R, in A> { R DoSomething(A arg); } interface IInvariant<R, A> { R DoSomething(A arg); } The IL for both looks the...

How to find a path to a native library loaded using DllImport in .NET?

Is there a way to find the path to a native dll loaded with DllImport? The only thing that comes to my mind is a series of calls: LoadLibrary(), GetModuleFileName() and FreeLibrary(). ...

Unable to read data from the transport connection: the connection was closed

The exception is Remoting Exception - Authentication Failure. The detailed message says "Unable to read data from the transport connection: the connection was closed." I'm having trouble with creating two simple servers that can comunicate as remote objects in C#. ServerInfo is just a class I created that holds the IP and Port and can g...

Problem using a costum server control in a aspx

Hi guys, i am having a issue. I already developed one class (my custom gridview) and i want use it on a .aspx That class is defined in app_code and compiled to the dll of the project. namespace MyCostumControls{  public class DropDownPagingGridView : GridView{ ... I already registered the control on the aspx page using <%@ Regist...

Unit Testing a CSV Parser and Column Mapping Tool

I am really starting to enjoy unit testing and have the following question to the gurus of unit testing. Let's for example say I have the following class public class FileMapper { public Dictionary<string, string> ReadFile(string filename, string delimeter){} } How do you guys generally go about unit testing a Parser or ReadFile m...

Is it possible to reference two identically named namespaces?

The title should say it all... EDIT: Apparently the title didn't say it all, but Jon Skeet was able to figure out what I meant anyway! ...

Can .NET convert "Yes" & "No" to boolean without If?

You would think there would be a way using DirectCast, TryCast, CType etc but all of them seem to choke on it e.g.: CType("Yes", Boolean) You get: System.InvalidCastException - Conversion from string "Yes" to type 'Boolean' is not valid. ...

How does linq Last() work?

I dont understand how current can be null and last can be an object while last being a LINQ function. I thought last uses GetEnumerator and keeps going until current == null and returns the object. However as you can see the first GetEnumerator().Current is null and last somehow returns an object. How do linq Last() work? var.GetEnumer...

Can Visual Studio 2010 outlining be fixed for VB.NET?

After upgrading from VS 2008 to VS 2010 we have noticed a few annoyances (including issues with resource based imagelists on 64bit systems), but none have been as bad as the way VS 2010 shows outlined methods for VB.NET. Previously in VS 2008 when a method is outlined you got the method outline with correctly colored keywords. Now all y...