.net

Exception is occuring only on my machine: Method not found: WaitHandle.WaitOne(Int32)

Exception is occuring only on my machine inside a referenced .dll: Method not found: WaitHandle.WaitOne(Int32) This appears to be a .NET runtime version problem but I've installed .NET 3.5 and restarted and am still seeing the same issue. Gacutil shows mscorlib Version 2.0.0.0. We have modified the code to call the two parameter Wait...

MDI Child .Show() Method Raises NullReferenceException in Framework

The below is an involved problem, I've done a great amount of research, but have been unable to solve it thus far. I'm happy to find either a solution or a workaround. Although the framework is old (1.0) I am not at this stage able to upgrade to 1.1 or later (the client isn't willing to pay for the conversion at present), and I'm not eve...

Is CultureInfo.CurrentCulture really necessary in String.Format() ?

Hi. How do you think is really necessary to provide IFormatProvider in method String.Format(string, object) ? Is it better to write full variant String.Format(CultureInfo.CurrentCulture, "String is {0}", str) or just String.Format("String is {0}", str) ? ...

Is it possible to track every http/url redirects using .NET?

I'm doing a windows forms application and it requires me to log every url redirect that's happening on the user's machine. Like when a user googles something and he clicked on a sponsored link, there will be a number of redirects that'll happen there and i would like to track those redirects. Is there any listener class that I can use t...

Is it necessary to dispose System.Timers.Timer if you use one in your application?

I am using System.Timers.Timer class in one of the classes in my application. I know that Timer class has Dispose method inherited from the parent Component class that implements IDisposable interface. Instances of the class below are created many times during my application lifecycle; each of them has an instance of Timer class that gen...

Comparison of .NET Validation Frameworks

I was searching for a validation framework for .NET. I saw a few, but I didn't see any comparisons. Which one do you prefer to use, and why? ...

ADO.NET Entities Framework Performance Tips Every Developer Should Know

What are the performance tips that every ADO.NET EF developer should know about? Please put each tip per answer and explain why the tip is good (e.g. by minimizing DB roundtrips). ...

Should you use accessor properties from within the class, or just from outside of the class?

I have a class 'Data' that uses a getter to access some array. If the array is null, then I want Data to access the file, fill up the array, and then return the specific value. Now here's my question: When creating getters and setters should you also use those same accessor properties as your way of accessing that array (in this case...

ASP.NET MVC - adding action filters programmatically

Hello, I've been doing a bit of research regarding action filters and wondered if there was a way to add them programmatically to controllers?? To give some context, I'd like to add a logging filter if logging is configured in the web.config, otherwise I don't want the filter to exist in the execution chain of each action method. I ap...

A Question about the .NET garbage collector when cyclic references exist

I'm aware that the .net garbage collector detects cyclic references but I was wondering whether cyclic references may cause objects to stay longer than necessary. I have a cyclic reference in my ASP.NET app (an intended one for performance related reasons), can I get away with that? Regards ...

How to retrieve unknown type from wcf service?

I'm currently working on a wcf service that does some lookups in a database and return the data to the client. The user has entered an id of something he wants to see in a textbox. This could be a client-id, a product-id, an order-id or whatever. The lookup method on the server tries to find the id in the client table. If it's not in the...

Nant or MSBuild, which one to choose and when?

I am aware there are other nant and msbuild related questions on stack overflow, but I could not find a direct comparison between the two and so here is the question. When should one choose Nant over MSBuild? Which one is better for what? Is Nant more suitable for home/open source projects and MSBuild for work projects? What is your exp...

Add ado.net data tables to a blank MDB file

I'm wondering how to add several data tables that I've built in code, to a blank MDB file that ships with my app. I find it easy enough to connect to the MDB file via the OledbConnection object, but then I'm at a loss for an easy way to add my tables to it. There it sits...open...and empty, but what next? I can add my tables to a datas...

What are the best practices for returning errors from functions?

Hi, I usually do something like the example below when I need to return error messages from a function, if no errors occur I just return an empyty string. Is this best practice, or are there alternatve ways of returning error messages from functions? Function Test() as String ' Do something If error occured Then Return "Some...

Check wherever WordprocessingDocument is empty

Hi, all! How to check from WordprocessingDocument wherever word document is empty? ...

Best serialization library for .net with ability to deserialize inheritance correctly

I need a serialization library for .net with better features than the default xml serializer. The problem is that it is not polymorphic - say you have class B : A { }, and have serialized an type B, you should be able to call A myBaseType = Deserialize(xml) on it and be returned an instance of type B in the myBaseType variable. I have...

Host files or stream data on a self-hosted WCF (non-IIS) service that uses HTTP?

Is it possible to host custom data on self-hosted HTTP-configured WCF services, such as custom HTML or XML files, without involving IIS? I’m speaking of a ServiceHost instance that instantiates its own EndPoints/listeners. I have an app that uses a self-hosted WCF service and it has a Windows Forms client but I’m looking at adding a lig...

NHibernate: can't successfully set lazy loading

I have a table Parent and a table Child. Child contains a foreign-key to the Parent table, creating a one-to-many relationship. Here is a part of my mapping that I define with fluent NHibernate: public class ParentMap : ClassMap<Parent> { public ParentMap() { WithTable("Parents"); Id(x => x.Id, "ParentID") ...

How to design an ASP.NET MVC site for caching with Velocity?

I'm coming from the LAMP world, where the "cache everything" mentality is prevalent. Everything is put in memcache. I'm starting a new project with ASP.NET MVC and SQL Server. I'll probably go with LINQ to SQL or maybe Entity Framework. Are there design decisions I need to make now for caching, or is it easy enough to start using Vel...

Problem applying texture to square in OpenGL

I'm stuck at not being able to map texture to a square in openGLES. I'm trying to display a jpg image on the screen, and in order for me to do that, I draw a square that I want to then map image onto. However all I get as an output is a white square. I don't know what am I doing wrong. And this problem is preventing me from moving forwar...