.net

Wrong line numbers in stack trace (release)

Sometimes we receive stack traces from our customer with wrong line numbers. It happens not so often, but sometimes it puzzles us. Customers have release assemblies with optimizations and with "pdb only" debug information. And yes, we compare line numbers with exactly the same version of code the customer has. And yes, customer has ri...

Adding "Reset" Command to a Control's Extended Property in Property Grid

I have an Extender component of IExtenderProvider which extends a TextBox to have a "selected color". The default value for this color is "highlight". The user can change the "default selected color" in the Extender's property grid. If no extended TextBox has "selected color" defined, it will use the specified "default deleted color" val...

How to fetch notifications from Facebook

How to fetch notifications from face book. Is there any web-service or REST-based service by which we could fetch the notifications, contacts etc (like that in case of twitter). ...

How to add TOC to Clickonce installer?

I publish my ClickOnce from Visual Studio, but see no option to add licensing and terms and conditions to it. I refuse to believe that Microsoft left this crucial part of installation out, so could someone tell me how to do it? Edit: Possible duplicate : http://stackoverflow.com/questions/834071/clickonce-ask-for-a-license-agreement ...

Don't stop debugger at THAT exception when it's thrown and caught

In tools/exceptions, I've set the option that the debugger stops when an exception is thrown. Whether it is caught or not . How do I exclude an exception of that rule? Somewhere in my code there is a caught exception that is part of the program logic. So I obviously don't want that exception to stop the debugger each time it is hit. E...

Good way to create an idle loop in C#?

I have an app it sets up a FileSystemWatcher. It should run indefinitely. What is the best way to have it run in an idle loop? I'm currently doing FileSystemWatcher watch = ... //setup the watcher watch.EnableRaisingEvents = true; while (true) { Thread.Sleep(int.MaxValue); } which seems to work (ie, captures the events and does...

How to use NHibernate to query by unique-key values

I'd like to use Example.Create() to query just by the unique values of an instance. To do so I need to find out the value of the unique-key property that had been set inside the mapping file, like this: <property name="MyColumn"> <column name="MyColumn" unique-key="MyUniqueKeyGroup"/> </property> For better understanding - her...

How can I detect the type of a dll? (COM, .NET, WIN32)

I need to process a number of dll's and exe files in a folder and determine what type of file I am dealing with: .NET, COM, Win32 or some other alien life form. I've been trying to determine the easiest way to detect the type of a DLL, what do you think of this: COM dll => I do a LoadLibrary, then GetProcAddress for "DllRegisterServer...

Is double Multiplication Broken in .NET?

If I execute the following expression in C#: double i = 10*0.69; i is: 6.8999999999999995. Why? I understand numbers such as 1/3 can be hard to represent in binary as it has infinite recurring decimal places but this is not the case for 0.69. And 0.69 can easily be represented in binary, one binary number for 69 and another to denot...

How to block a website programatically using DotNet

Hi I am developing a windows application to block the websites from a computer using DotNet windows programming.I found some results to block an url but not for a website. That is I have to block complete website not a single url. So can some one help me to solve this problem Thanking You Chaithanya ...

Is there a tool for .Net that creates a programme / dependency flow chart from IL / source?

I am trying to see how a bunch of .Net functions are used throughout a very large project and I would like to visually chart them so I can see the flow from / to each function. There are only a few functions I want to track so it is not an exhaustive view. Thanks Ryan ...

How to correctly handle a centered MDI form background image

I have an MDI form with a centered background image. Each time the user changes the size or state of the form, the image isn't updated at all. It remains in the old place (not centered any more) and is even lost when the form is made too small. How can this situation correctly be handled? Do I really have to call "this.Refresh()" in all...

In the ORM designer, why don't the server objects get refreshed properly with new changes?

Whenever I use the ORM deisgner in LinqToSql I have real problems trying to get the latest objects from the server explorer after i've updated them in the database. For example, I have dragged in a stored procedure to handle my insert/updates, which creates the method for me to call. Problem is I then have to go and change one of the p...

How to block a website programatically using DotNet

HAI I am developing a software to run on the server and block the websites on the client systems using the client system name. My application is if I block www.google.com,entire website should be blocked i.e if user types www.google.co.in,it should not show the webpage of google.I have to block not a single url by editing c:\windows\sys...

jQuery .NET webservice call, parameter based on value in table cell...

I have a web service that wish to call, and I want to pass a parameter to it based on a value in a table cell. The table is rendered by a Repeater Control. The idea is to show a div with data returned from the database call, performed by the webservice, when I hover over the table rows. The javascript call looks like this: $(document)...

Is it possible to emit a type deriving from a generic type while specifying itself as the generic type parameter?

Dear ladies and sirs. Imagine the following perfectly legal type hierarchy: class A<T> where T : A<T> { } class B : A<B> { public B():base(){} } My question is given a statically compiled definition of A<> is it possible to emit the type B dynamically? The problem is how to specify the parent type in ModuleBuilder.DefineType. Or...

Join and Calculate Average of column using LINQ to sql

I have two tables Video VideoId, VideoName, VideoUrl Comment CommId, VideoId, CommentDesc, Rating I want to join and get average rating for video using LINQ How can I do this? ...

Parallel server-side processing of Sharepoint Web Parts

Here's the scenario. I have a number of Sharepoint Web Parts which display data to the user in a grid format. They all connect to a navigation web part which the user can use to select parameters for each of the data grids. On the back end, the grid web part calls a DI container to get an "IDataProvider," which queries some SoR and retur...

C# Asyn. Socket Programming

Is it possible to unit test the Asyn. socket programming (using c#)? Provide some sample unit test code. ...

Compiled Queries and Sequence Parameters

I know I can't use something like int[] or list as a parameter to a compiled query, but I need to find someway get the performance benefits of a compiled query that accepts n number of integers as a parameter. Has anyone found any work arounds or alternative solutions to this issue? ...