.net

AsyncCallBack CompletedSynchronously

I've noticed the following pattern recently, but I don't entirely grasp the usage of the CompletedSynchronously property: IAsyncResult channelOpenResult = channel.BeginOpen(new AsyncCallback(OnOpenCompleteChannel), channel); if (channelOpenResult.CompletedSynchronously) { CompleteOpenChannel(channelOpenResult); } And then ag...

Is it possible to reflect a running .NET process?

Dear ladies and sirs. I have an application with dynamic types emitted at run-time. In order to inspect the generated .NET code, we save the dynamically generated assemblies and use the Reflector. I am wondering whether there is a way to reflect them the Reflector way while the respective process is running, without having to save th...

How to use two different Microsoft Interop assemblies in one project ?

I want to use two different Microsoft.Office.Interop assemblies (version 11 and 12) depending on the Office version installed on customer's machine. I've been able to add these two asseblies to my project ( I am using them loccaly - they are in my bin folder, in two diffrent subfolders) , I used aliases on this assemblies to be able to ...

How to detect when application terminates?

This is a follow up to my initial question and I would like to present my findings and ask for corrections, ideas and insights. My findings (or rather interpretations) come from people's answers to my previous question, reading MSDN .NET 3.5 documentation and debugging .NET 3.5 code. I hope this will be of value to someone who was wonder...

Stick application to the Desktop on Vista

I have an application that I want to stick to the desktop. Stick to the desktop means that every time that someone click windows+D or the show desktop icon the desktop will appear with the application on it. The user can locate the application on the desktop and change the location at any time but it always remains on the desktop. We m...

Xenocode Postbuild and RemoteSoft's Salamander: Experiences? Preferences?

One of my client's requirements is that the product be distributed without the need for other installations - e.g. .net. After research I have found Xenocode's Postbuild and RemoteSoft's Salamander. Both seem to do what I need. Has anyone here used either of these tools and will you share your experiences? Can you compare the costs? ...

How to define Transaction Timeout during debugging application.

I am testing whether option from app.config listed below Is applied to all transactions in the application. <system.transactions> <defaultSettings timeout="00:05:00" /> </system.transactions> Transaction are defined using transaction scope in following way using (TransactionScope transactionScope = new TransactionScope(Transactio...

Porting WISA stack to Linux + Mono

We're currently running a Windows/IIS/MSSQL/ASP.Net3.5 stack for internal development and it's great, mostly for the developers who are enjoying the tight integration with Visual Studio etc. Problem is, we want to scale and don't want to be tied to a Microsoft OS. These days Linux+Mono is looking very interesting, but I don't know of ma...

Design-time editor support for controls collection

I'd like to add a property which represents a collection of controls to a component and have a collection editor with which I can easily select the controls that belong to the collection. VS does almost what I want automatically with the following code: Private _controls As New List(Of Control) <DesignerSerializationVisibility(D...

.NET simple app update mechanism

Environment: .NET c# VS2005 and some 3rd party components .vdproj files (setup projects inside VS 2005) for .msi building - not "one click deployment" Problem I am in a project phase where there are several updates to the project during a day. Since every change is small (two assemblies at most), it would be convenient for the u...

C# architecture guidelines vs JavaEE

When I first switched from Java to C#, I was really impressed with C#'s features. However, it seems to me that C# has yet to provide solid infrastructures in the way JavaEE does. Everytime I try to integrate C#'s features into scalable or complexe architectures, it always comes down to: How can I twist this so it can be MVC / MVP? Datab...

What binary rewriter is used to implement Microsoft's Code Contracts?

I am talking about those Code Contracts that will end up in .NET 4.0. What binary rewriter do they use to inject the code that makes it all work and is it publicly available? I hope it's not just a compiler thing because I would love to be able to use their binary rewriter for AOP. ...

Can you explain inheritance in Nhibernate to me?

Im having a hard time understanding how inheritance works with NHibernate, with regards to mapping with .hbm.xml files. ...

How to get another user WindowsIdentity without knowing his password?

Hello, I'm trying to intercept WindowsAuthenticationModule to login into application as another user, but I cannot create new WindowsIdentity without knowing his password. The code will run under administrator privilegies, so, is there any way how to get user 'Login token' without his password? ...

Is it possible to have extra context inside the AssemblyResolve method?

Dear ladies and sirs. Motivation. I have a client-server application. At some point the server side creates a new type dynamically based on certain metadata, unavailable to the client. The server needs to send an instance of the type to the client. However, the client will fail to deserialize the instance, because its type is unknown. ...

How to add folder to assembly search path at runtime in .NET?

My DLLs are loaded by a third-party application, which we can not customize. My assemblies have to be located in their own folder. I can not put them into GAC (my application has a requirement to be deployed using XCOPY). When the root DLL tries to load resource or type from another DLL (in the same folder), the loading fails (FileNotFou...

Sorting in DataGridView using DataSource property

I have a List that contain items for eg: 1)https:\10.12.23\ 2)https:\12.23.12.25\ 3)https:\localhost\ 4)https:\12.25.12.2\ 5)https:\12.36.12.22\ 6)https:\12.88.12.32\ When I bound List into DataGridView as below: MyDataGridView.DataSource = MyList; I want that the item "https:\localhost\" should be on the top.. how can I acheive this...

Can I make the default AppDomain use shadow copies of certain assemblies?

A short explanation of why I want to do this: I am busy writing a plugin for Autodesk Revit Architecture 2010. Testing my plugin code is extremly cumbersome, as I have to restart Autodesk for each debug session, manually load a Revit project, click on the Add-Ins tab and then start my plugin. This is just taking too long. I have writte...

What information does a .NET class have about what is calling it?

I'm building a class project (seperate dll) that will contain various helper methods and common functionality, to be accessed by a range of different applications - an ASP.NET website, a web service and a Windows service. Is there any way that this neutral class can determine the type of application that is calling it (so it could, for ...

msbuild not updating revision number using AssemblyInfoTask

After much Googling, I found a custom task that could increment my revision number while building my project using msbuild. However, the revision number is not being updated. Without modifying my "Microsoft.VersionNumber.targets" file, the build fails and says "The version specified '0.0.090903.0' is invalid". So I found this link which ...