.net

What is the difference between managed and native resources when disposing? (.NET)

I was reading the MSDN article about how to implement IDisposable and I am uncertain about the difference between managed and native resources cited in the article. I have a class that must dispose 2 of its fields when it is disposed. Should I treat them as Managed (dispose only when disposing = true) or Native resources? ...

SQL Server: Server-side blob cursor?

i'd like to read binary data from a blob, using the Stream interface around it. But i don't want the blob to have to be loaded entirely client side and stored in memory, or in a file. i want the code that uses the blob to be able to seek and read, and only as much data that is needed to support seek/read is brought over the wire. i.e...

What page-image generating technology should I use?

I'm building a desktop application right now that presents its human-readable output as XHTML displayed in a WebBrowser control. Eventually, this output is going to have to be converted from an XHTML file to a document image in an imaging system. Unlike XHTML documents, the document image has to be divided into physical pages; addition...

How to write safe/correct multi-threaded code in .Net?

Today I had to fix some older VB.Net 1.0 code which is using threads. The problem was with updating UI elements from the worker thread instead of the UI-thread. It took me some time to find out that I can use assertions with InvokeRequired to find the problem. Besides the above mentioned concurrent modification problem, there are deadlo...

Build (Compile) project programmatically in VB.NET

How can I build a Project programattically in VB.NET ? ...

In WPF Stretch a control to fill a ListView Column

How do I make a control fill the whole cell in a ListView (with a GridView)? I've played around with various properties, but the control is always it's minimum size. Here's my xaml. <Window x:Class="ListViewUserControlTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.c...

DbC (Design by Contract) and Unit Tests

I am using contracts with C# 4.0 and before I was using lots of unit tests (not with TDD). I am wondering if DbC eliminates the need to write external unit tests? Personally I find contracts better to make robust frameworks, as the contracts are closely coupled with the code itself, and offers other benefits. What do you guys think? ...

Visual Web Developer and multiple sites on the same FTP server

I used Visual Web Developer to open up Website_A directly through FTP, which was real nice. It let me edit the files on my computer and then save them right up to the server so I could see the effects my changes were having immediately. This is just like what I used to do with UltraEdit on non .Net sites, but with the added benefit of ...

.net Garbage Collection and managed resources

Is the memory from primitive data types (int, char,etc) immediately released once they leave scope, or added to garbage collection for later release? consider: For x as integer=0 to 1000 dim y as integer Next If this doesn't add 1000 integers to the garbage collector for clean up later, how does it treat string objects? would this cr...

.NET - SQL Connection Error - Developing a Web App Locally

I have Visual Studio 2008 and SQL Server 2008 Developer Edition installed on a Windows XP machine. I get this error when trying to work on a Test Web Application: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instan...

In .NET remoting what is the difference between RemotingConfiguration.RegisterWellKnownServiceType and RemotingServices.Marshal?

In .NET remoting what is the difference between RemotingConfiguration.RegisterWellKnownServiceType and RemotingServices.Marshal? What I want to do is create an object in a Windows Service, then put it in as a remoting object and have the Windows Service and the Client both act on the remoting object. I thought the below code would acco...

Opensource project setup

I want to set up an opensource community project in .NET, how do I go about it? ...

Transactions across several DAL methods from the one method in the BLL

How would you go about calling several methods in the data access layer from one method in the business logic layer so that all of the SQL commands lived in one SQL transaction? Each one of the DAL methods may be called individually from other places in the BLL, so there is no guarantee that the data layer methods are always part of a ...

Visual C++ GUI app stuck in MTA mode

I've got a C++ gui project exhibiting some strange behavior. On my machine, the code compiles and runs just fine. However, on another machine, The code compiles but ends up running in MTA somehow. Obviously, being in MTA causes all sorts of runtime problems for the GUI. Here is my main: [STAThreadAttribute] int main(...

Custom object returning as "empty" from WCF?

For what reason(s) should WCF return me a "empty" instantiated object when it was clearly populated on my WCF service return before it went over the wire? For instance a simple OperationContract method: response.Client = new Client(); response.Client.ID = 99; return response; returns an "empty" Client object (on the client receiving ...

Obtain a ResourceManager for a static lib.

I have a Managed C++ project that compiles as a lib and is referenced by a windows forms .exe. This lib in turn references a DLL which contains localization code. The constructor of ResourceManager expects an Assembly object representing the parent of the resource. How do I create a new ResourceManager that references resources stored in...

Is it MVC when the view doesn't interact with the model?

I've designed an MVC (in .NET) where the View has no link to the Model. It only knows about the Controller. The traditional MVC pattern has all parts communicating with each other. In my case, the Controller is basically a mediator. This keeps any exceptions or logic out of the View. It has zero dependency on the Model. Is this no ...

Respecting on-the-fly changes to Windows time format.

I am working on a C# app that tries to respect the time format of the system it is running on. If the Windows control panel is changed to 24 hour format, that is the format the app will display time in. Anyway, it does this successfully, except it will only work if the time format is changed before the app is run. If you change the Wi...

Looking for a .NET library to do authentication that support multiple sources.

I'm looking for a suggestion for a .NET library which can allow me to use in an ASP.NET application so that I have one profile for each user, but can associate authentication from multiple sources including: ASP.NET Forms based, windows live id, google, facebook, openid, etc... I want people to come to my website and be able to associate...

encrypting a .Net application and assemblies

Hi, I have an encryption/copy protection question. I'm writing an application for a company that uses a dongle. Please don't tell me that software protection is useless, or that I should just let it fly free into the air, or that any time I spend doing this is a waste; this isn't a philosophical question about the validity of software...