.net

Why does .NET foreach loop throw NullRefException when collection is null?

So I frequently run into this situation... where Do.Something(...) returns a null collection, like so: int[] returnArray = Do.Something(...); Then, I try to use this collection like so: foreach (int i in returnArray) { // do some more stuff } I'm just curious, why can't a foreach loop operate on a null collection? It seems log...

How does the garbage collector work with unit tests?

Recently, I asked (and answered) a question on StackOverflow about why a unit test would work when run by itself and then fail sporadically when run with the whole batch of unit tests. See here: http://stackoverflow.com/questions/3072986/sql-server-and-transactionscope-with-msdtc-sporadically-cant-get-connection Unit tests passing when...

C# win form custom control - disable selection box, and use font color for selection indicator.

I have a custom control based on the label control. My question is how I disable the selection box around this custom control when a user selects it while in design mode. I would like to just change the font color when selected, and then change it back when unselected. The reason for this is because when you have many labels with small...

.Net bindingcontext update method

Hello, I'm using databinding (through LINQ to SQL) in a C# form and I need to know how to update the BindingContext when a new item is added to my Table. More specifically, I have form that displays the properties of a project in various fields. The user can traverse to different projects through the project name combo box. At the ...

Entity Framework 4.0 Use Database Default Value

I am using Entity Framework 4.0 Many of our tables have a column called RowID, used by the DBA to track stuff. The column is NON NULLABLE has a database default value that maps to a function. The problem is, the EDMX Model requires this property to have a value on the Entity, making construction of the object difficult. I have read ma...

VST.NET vs NAUDIO (vstaudiobuffer vs pcmstream buffer)

please help me how to convert VSTaudiobuffer to PCMStream Buffer i tried from http://vstnet.codeplex.com/Thread/View.aspx?ThreadId=216682 but to no avail. int inputCount = PluginContext.PluginInfo.AudioInputCount; int outputCount = PluginContext.PluginInfo.AudioOutputCount; int blockSize =...

Call Function Import from custom ObjectContext

I have an object that inherits the EF ObjectContext object and I want to call a Function Import I created. Anyone know how to do that? Do I have to use ExecuteFunction()? Thanks! ...

When does the .net garbage collector run?

When I debug .net code, how can I know when the garbage collector runs? I do not wish to control when the garbage collector runs. I only wish to be able to know when it is running. I have some code that is running out of resources. I know that the resources are not being used; I want to know when the GC is running to free them. Oh, ...

Message Queue MSMQ always defaults to workgroup instead of domain mode on SBS 2008

Hi: I don't know too much about MSMQ. I need to install it on a client's machine. It is a small business server 2008. I installed MSMQ (including the messaging queue and Directory Service Integration) However, it always defaults back to workgroup mode instead of domain mode for some reason, i tried so many different things, still didn'...

Create Function Import on overloaded Stored Procedure in Oracle, Entity Framework

Is there a way to create a Function Import on an Oracle stored procedure that is overloaded? I have a login sp that is overloaded three times. I tried to create a Function Import for it but EF doesn't let me pick which sp I want to create. It creates the one with the least amount of parameters. Any ideas? Thanks! ...

How to pass Json serialized object to javascript (ASP.NET C#)

Hi, i have a method that returns a list of serialized objects in my page code behind private string Get() { JavaScriptSerializer jsonSerialiser = new JavaScriptSerializer(); string jsonString = SerializeToJason(UnavailabilityBusiness.Get(new DateTime())); return jsonString ; } i would like to pass this serialized obj...

what is a byte[] array?

This could be a very simple CS question but I just still do not get what byte array is in the context of .net framework. I am familiar with standard definitions like array and byte and very familiar with EE concepts such as Byte. But I fail to connect it in terms of CS concepts. I see it used every where and I use it with out really unde...

Windows 7 version for .NET web tools - VS2010 and Sql Server 2008 express

I want to buy a new laptop to do .NET web development and am wondering what version of the Windows 7 OS I need to buy. The options are Windows 7 Home premium 64 bit or I pay $120 more and get the Windows 7 Professional 64 bit, which I really dont want to pay for if I dont need it. I would like to Install Visual Studio 2010, SQL Server 2...

BackgroundWorker.ReportProgress confusing examples?

In almost all tutorials of BackgroundWorker the reportProgress event is handled like this (this example is from MSDN http://msdn.microsoft.com/en-us/library/cc221403(VS.95).aspx) private void bw_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; for (int i = 1; (i <= 10); i++) { if ...

issues getting .NET service installed

I've been having on and off issues trying to get a service installed. The problem is it installs fine on some machines, and others I either get that the service couldn't install because of incorrect permissions, or that the service could be started, and these are all administrator account. I'm installing it using Advanced Installer. Wha...

Is there a way to program in c# such that when an exe runs, it serves and handles requests on localhost

I want to make a program that hosts a webpage with computer uptime of the system it is running on but I don't want to do anything to the user's IIS. Is there anyway to do by making some system calls (to the ISAPI dlls etc) in c#? ...

Debugging a remote process

Hi, i have a general question about debugging a .NET process that has been built locally but deployed to a remote machine. If the process was built in DEBUG mode and was deployed WITH pdb's, is there any software or technologies available that allow you to hook in or attach to the process for debugging purposes without installing visual ...

Background Worker Process With WCF (Caching)

Hello All, I am tasked with building a process which will compensate for replication delays on our LDAP system. Currently, there is one write server and 4 read servers. After writing an entry to the write server there can be up to a 4 second delay on the system before the entry is replicated to the read servers. Therefore, if I call ...

Read USB using .NET

I have read many codes and none match each other.. I did little bit of programming but one thing i' confused about is: how many ways you can read a USB (how many classes or libraries i have to call to do such a thing)? when you use .serial port( does that mean you are reading a serial port or even the USB uses the same class or library)?...

Image storage/search web application

Hi, I work for a multimedia department of the government and we have a lot of images that we would like to share with others departments. Here some information: We have around 20TB of images and photos to share. We already have a windows 2008 environment running .net mvc web applications. We already have a mssql cluster in place. We ...