.net

Invalidating an object reference while another thread is executing a method on it (.NET)

(I'm interested in the .NET CLR) What exactly happens when one thread changes the object a variable references while another thread is executing a method on the original object? For example, say the type Foo has a variable 'Bar' of the type Bar, and Bar has no class-level state (for now at least, I'd like to keep this scenario simple)...

Can the IIS network-user account call a WCF service running under a different account?

I'm currently looking into using WCF to communicate between a server and a program that acts as a facade for a legacy system. Quick overview: user <-> ASP .NET web pages <-> WCF <-> facade program <-> legacy system I don't want to run IIS with the rights required to run the facade program so I was thinking about using WCF to communicat...

How can I achieve Aero's glass effect cross platform?

Duplicate: Is it possible to achieve the “Aero Glass” look on XP? If I use Winforms and I write a win32 application with it, I can see the Aero glass effects in Vista but not in XP. How could I achieve the same look across different platforms? I am using WPF. As a side question, did Microsoft write the Aero glass effects using ...

Exception Due to Type Missing From Assembly (Revised)

Hello All, I have made some progress on the problem I posted about yesterday, so I am rewriting the post. My problem appears to be related to my use of generics. Here's the relevant part of App.config (formatted with whitespace for readability): <configSections> <section name="NA5300ResolverSynchroDevices" type="In...

Drawing.Graphics - Way to change pixel offset of source bitmap?

Hi, Having a small problem finding a function or method to do what I'm looking for, hoping someone might be able to give a bit of insight here. I've got a function that's supposed to extract and return a 32x32px bitmap from a larger bitmap which has a set of 32x32 tiles inside it. Here's the code I have now, but it's wrong since the Ti...

Why is Microsoft source code so complex?

I have been looking at the source code for Microsoft .NET Libraries such as System.Web...... Whenever I look inside the code, I see flags, events, a whole ecosystem of rather complicated code which seems like overkill to do a pretty simple thing. It's filled with absolutely everything. I'm not sure I saw a simple piece of code inside ...

Questions about .NET and Xenocode Postbuild

Referring to this topic (and accepted answer). Isn't .NET Windows only (except for emulators)? How will using Xenocode Postbuild affect the portability of the application? Will compiling my application using Xenocode Postbuild affect the size/speed of it? Which way? Generally: What are the differences/advantages/disadvantages of the VS...

Going from <solution> to <exec program=msbuild> in NAnt

I've converted my app from .NET 1.1 to .NET 3.5 and unfortunately NAnt's tag does not support .NET 3.5. So I am trying to use the tag to kick off msbuild directly. Here is what I have for .NET 1.1: <solution solutionfile="MyApp.sln" configuration="ServerDebug" outputdir="MyApp\bin\ServerDebug"> <assemblyfold...

How do I generate a list of strings representing 15 minute time intervals between a start and end times in a single day using C#?

I'm creating a form where a user will be able to specify a beginning and end times using preset values. I would like to generate a list of string representations of available 15 min intervals between 9 AM and 5 PM in a single day. ...

Accessing the root visual of a ContentPresenter hosting a DataTemplate

I'm working with the Adorner model with drag and drop, and I'm instantiating a DataTemplate through a ContentPresenter and adding it to the Adorner layer of my control/window. The problem I have is I need to register mouse events on the root visual element of the instantiated DataTemplate so I can change state and detect the drop in my B...

Exception.Data info is missing in EntLib log

How do I get the Exception Handling Application Block (EHAB) to write the values from the Exception.Data property in the log? try { // ... } catch (Exception ex) { ex.Data.Add("Hello", "World"); throw ex; } The exception is logged correctly, but I can’t find the added data anywhere in the log entry created by ...

C# XML Serialization of an array - Skip "empty" string values

I want to skip the empty element creation in XML file during the xml Serialization in C#. Ex : ArrayElements elm = new ArrayElements { Items =new string[] "Item1", " ", "Item2", " ", " ", "Items" } }; During the serialization it should skip the empty strings. This is my class : [Serializable] public class ArrayElements { [Xml...

How to check the MSMQ messagebody is valid or not

Hi, Iam new to .Net and working on MSMQ I want to check whether the body of a message receives is valid or not , so I am doing a validation " msmqMessage.Body == null " , but this throws exception . I also found that the bodytype is 0 when this happens other wise it will be 768 So is it ok to check whether the bodytype ==0 for invalid...

Vista - Program crash notification

My memory is fuzzy but I seem to recall that Windows Vista introduced an ability to know why an application crashed. But I cannot remember the name of the feature. My intent is that if my application crashed for some unknown reason, the next time it starts up I'd like to know why - or even just to know that it happened. Does anyone rem...

strange out-of-memory exception during serialization

Hello everyone, I am using VSTS2008 + C# + .Net 3.5 to run this console application on x64 Server 2003 Enterprise with 12G physical memory. Here is my code, and I find when executing statement bformatter.Serialize(stream, table), there is out of memory exception. I monitored memory usage through Perormance Tab of Task Manager and I fin...

Auto browser refresh during web development

It is well and good that the server restarts automatically for each change in the code. How would you have even the browser refresh automatically, as per configuration (Turn on and off, the least). How to do it on Windows, and on Linux, for all different development frameworks. What existing packages allow you to do it, and if you are ...

Error creating a WCF endpoint

Hi there, Why do I need to include a DnsEndpointIdentity when creating my WCF endpoints? So when I create an endPoint like this: EndpointAddress endpoint = new EndpointAddress(uri); I get a SSPI authentication failed error But when I do this it works just fine: DnsEndpointIdentity endpointIdentity = new DnsEndpointIdentity("sa...

Bind the content of DataTemplate to another userControl

Hi all, may you happy every day I am new in silverlight Suppose I am writing a user control(name as AAA.xaml) which contains a DataTemplate, in which I want to have another user control's(defined in BBB.xaml) instance by data binding. I initilize a instance of BBB user control(name as bbb) in AAA.cs(the c# file of AAA.xaml), and I wan...

How to trap the keyboard strokes on a c# win forms application (CTRl + alt +Del)

Is there Any way to handle the crtl + Alt + Del Key combination. Take for instance in a quiz application (Win Forms ), the user should not be able to switch to other windows till the test is over. I'm able to capture the ctrl and alt key strokes individually, using c# standard properties. but once they user hits the del key . The contr...

WCF: What value should the servicePrincipalName have?

I'm trying to set up client impersonation on my service. I need to set a value for the servicePrincipalName of my services endPoint I'm looking at this but still cannot quite figure it out http://technet.microsoft.com/en-us/library/cc961723.aspx My service is hosted in a console app on a server that we'll call ServerName1. The Uri is...