.net

C#: How to call a method while forcing different marshalling?

A method declared in one of Microsoft's Primary Interop assemblies is wrong. It is declared as: void Write(object[] psarray); which is incorrect, and should actually be declared as: void Write([In, MarshalAs(UnmanagedType.SafeArray)] object[] psarray); I need to force the compiler to use [In, MarshalAs(UnmanagedType.SafeArray)], w...

.NET Assembly Binding How/Why (1.1, 2.0, GAC, Policy Files and more...)

I have been working through a number of very "odd" issues with some DLL versions, Policy Files, and items in the GAC and for the life of me I haven't been able to find a solid answer as to how/why the .NET framework picks the assemblies that it does, when binding project references. First of all to give a bit of history about what we ...

GUIDs in DLLs (.Net)

I'm not very experienced in this area - so I've got a few questions. Firstly, do all .Net created DLLs have their own GUID? If not, my question is how do I get one and associate it with the DLL. Then the question is, how do I get the GUID of that dll - ie. given a DLL path (c:\some\path\to\a\file.dll) how do I determine its GUID? Also, ...

WCF Client Inside SQL CLR

I know it's not supported, and I know it's not even a terribly good idea. But, I want to have a WCF client inside a SQL Table Valued Function. I've (seemingly) registered the correct assemblies, but when running my client - I get a WCF error: Msg 6522, Level 16, State 1, Line 1 System.ServiceModel.CommunicationObjectFaultedException: ...

How do you use a custom mouse Cursor in a .NET application?

Well, as the title says, how can I set an image or anything else as the mouse cursor. I know you can use the built in ones that are part of the Cursors class, but I was wondering if there's a way to use your own image (preferably without P/Invoke, but either way is fine.) EDIT: I guess I didn't explain what I wanted clearly enough. I do...

Is it possible to change the Sql Workflow Persistence Service table and stored procedure names?

I'm using the default Sql Workflow Persistence Service to manage workflow persistence in an application I'm developing. I used the scripts provided by Microsoft to generate the schema and logic in a SQL database. Up until now, it's worked great; however, I'd like to change the names of both the tables and stored procedures to comply with...

Invisible controls still being rendered

I'm having the weirdest problem. I have two PlaceHolders in a Master Page; one contains controls for users who are logged-out, and the other for users who are logged-in. They are: plhLoggedOut plhLoggedIn During my Page_Load (of the Master Page), I set their visibility like so: //LOGGED-IN? plhLoggedOut.Visible = (a...

How to test for sometimes fails?

I'm trying to write a unit test for a module that will give me a random list of numbers given certain criteria. The particular test I'm writing is a reshuffle of the original sequence. I'm testing that The sequences are the same length The sequences have the same values The sequences are not in the same order The problem with this i...

Consume ado.net data service from a non-dotnet-3.5 client

What are my options to access a ado.net data service from a .net 2.0 client? The client application has to run on Windows 2000 so upgrading to .net 3.5 is not an option. Other than writing my own proxy against the service, any other options out there? ...

Why aren't unsigned variables used more often?

It seems that unsigned integers would be useful for method parameters and class members that should never be negative, but I don't see many people writing code that way. I tried it myself and found the need to cast from int to uint somewhat annoying... Anyhow what are you thoughts on this? Duplicate Why is Array Length an Int and ...

LoaderLock error on program termination

I have recently integrated the .NET NLog logging component into one of our applications which developed purely in unmanaged code (C++ and VB6 components compiled in Visual Studio 6). We have a bunch of C++ application talking to NLog via a COM interface. Everything is working fine at the moment but I do notice that the following message...

How to add NHibernate configuration file to use NHibernate.Search?

I try to use NHibernate.Search that I built from trunk and use with NHibernate 2.0.1. When I add some NHibernate.Search properties config into configuaration file: <property name="hibernate.search.default.directory_provider">NHibernate.Search.Storage.RAMDirectoryProvider, NHibernate.Search</property> <property name="hibernate.search.def...

Videos on how to use Team Foundation Server for your Source Control

Any good videos online on how to use Team Foundation Server as your Source Control repository? I need something quick to get me jump started. ...

C# Design Patterns Book

Hi, I would like you learn more about Design Patterns for .NET (especially C#). Which book(s) would you recommend? ...

How do I display office and/or pdf content on a windows form?

We have an application in which admin members can add content for their subordinates to view. Their requirement is that it should be able to display word, excel, powerpoint and pdf documents in a non-editable manner. The one option that I found for doing this is to have the content loaded into a web browser component. The downside to ...

Converting Value Type of a Dictionary in VB.net

Public Class A Public Class B : Inherits A Dim DictA As Dictionary(Of Integer, A) Dim DictB As New Dictionary(Of Integer, B) DictA = DictB This doesn't work, as the type can't be converted. Is this somehow possible? ...

Visual Studio build problem

We have a VS 2003 solution containing 1 vb project and several c# projects(No web projects). The problem is when i try to build the vb project either VS exits or stuck at "performing main compilation". Please help Can not reproduce it. Clear build doesnt work. Sometimes problems is solved without doing anything logical. ...

WCF Message Level Security

Hi, Hope someone can help me on this matter. I'm looking for a way of enabling message level security on my WCF service other than using certificates. Problem is that the application is used on clients that connect via a VPN with multiple sites that each have their own domain controller and the domains does not trust each other. I'm tota...

How to check if a remote connection is open to the server?

I'm setting up my remoting connection like this: port = new Random().Next(REMOTING_PORT_MIN, REMOTING_PORT_MAX); TcpChannel chan = new TcpChannel(port); ChannelServices.RegisterChannel(chan, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(NotificationService), "CallOnMe.rem", WellKnownObjectMode.Singleton); notServic...

How do you Read SharePoint Lists Programatically?

I currently use the Linq to SharePoint to retrieve data from several SharePoint lists. This is my current preferred method of coding my way from ASP.NET and WinForms to retrieve this data. My only issue with this project: I have to manually generate the SPML file and add this to the development environment, compile it in the project...