.net

.net xmlserializer error

The error is when the class gets serialized, I don't get a run time error or anything (unless I try to deserialize). When the XmlSerializer serializes my class, some times it adds some text at then end of the XML. This happens often at the very end: </RootNode>ootNode> Some times it's not at the end but in the middle, something like ...

Dynamic Data without both database and model updates.

I have come to the conclusion that the very nifty ASP.NET Dynamic Data framework would be even more nifty if one only had to implement model changes from one side, model or DB. Right now, if I add a column or table, I must refresh my EF model, and then the scaffolding does the dirty work. I would much prefer a mechanism where I can upd...

NetworkInterface.GetAllNetworkInterfaces causes AppDomain.UnhandledException to stop firing on Windows XP Embedded

I have an application that targets desktop OSes (XP, Vista, Win7) as well as mobile devices running Windows XP Embedded. All platforms are running the full .Net Framework, not the Compact Framework. The app uses the AppDomain.UnhandledException event to detect and log any fatal application errors. Nothing unusual there, and it works perf...

What is the right way to compare two filenames to see if they are the same file?

So I have two Windows filenames I need to compare to determine if they are the same. One the user gave me, one given to me by another program. So how should you compare: C:\Program Files\Application1\APP.EXE C:\Progra~1\Applic~1\APP.EXE C:\program files\applic~1\app.exe I can't seem to find a way to consistently 'normalize' the pat...

Why make an EJB rather than a Web Service?

I would have thought that there is a lot of information out there on this, but I haven't found anything that really answers my question. What are the advantages of making an EJB rather than a web service? The only clear advantage I can come up with is performance. Even so, I can't find any hard data on how much more efficient EJBs are. ...

StructureMap web.config

I have this interface public interface ICartService : IService<Cart> { ... } Implementation of the interface public class CartService : ICartService { public CartService(ICartRepository repository) { _repository = repository; } ... } And in web.config <StructureMap Memento...

High-level multithreading/concurrency abstractions for .NET

I just wondered why, unlike Scala, F# or Haskell, the basic .NET framework (as available in C# or VB) seems to have very little native support for higher level concurrency patterns. There are basic mechanisms available - locks, monitors, the thread pool - but what about Synchronized variables (MVar) Synchronous channels Asynchronous ...

Can you override system.serviceModel configuration section?

Hi, We are trying to create a "proxy" class that would serve the WCF service with its configuration properties. Because we can't store those properties in the app.config file, i'm looking for a way to "proxy" it out and use custom configurationSection which would provide all these data upon request. In order to do so, i would need to ...

How do you dispose of IDisposableobject create inside of a Linq expression?

Linq allows you to create new object inside of a query expression. This is useful when you have classes that encapsulate generation of a list. I’m wondering how you dispose of objects that are created that need it? Example: class Generator { public IEnumerable<int> Gen(int size) { return Enumerable.Range(0, size); }...

how to use DynamicResource in the code behind ?

I'd like to be able to set a property to a dynamic resource programmatically. myControl.Property = this.Resource[key] is not a valid response, since if the resource with the key 'key' is replaced, the property is not updated automatically. Thanks for you response, ...

WPF synchronize Listview with some ViewCollection

hi there, I have a WPF Listview databound to an ObeservableCollection named "FilteredAppendixes". Now I create a view with: CollectionViewSource.GetDefaultView(FilteredAppendixes); The currentItemProperty of it will not be in sync with the Item I choose by Mouseclick in the listview. the CurrentITem property always remains the same fi...

.Net How to create a custom ThreadPool shared across all the AppDomain of a process?

I made a custom ThreadPool optimized for my specific needs. However, when there are multiple AppDomains in the process, the CLR ThreadPool is able to be shared across all the AppDomains and I would like to be able to reproduce this behavior. This could be done using MarshalByRefObject and Remoting in order to create a distributed Thread...

Errors/Warnings using svcutil.exe to create proxy classes for several WCF services

I'm writing a .NET 3.5 app and have control over both the WCF service and client. I'm using svcutil to generate proxy classes for my services, combining several services since they share data types. svcutil /out:ServiceReference.cs /noconfig /namespace:*,Global.ServiceReference /tcv:Version35 http://localhost:12345/first.svc http://loc...

How to trim an array in .NET?

Say I have an array array<double>^ buffer = gcnew array<double>(100); And I want a function that does something like: void foo(array<double>^% buffer) { Array::Resize(buffer, 10); } but that don't allocate and/or move &buffer[0] when you want to trim the array. ...

How can I reproduce the Firefox faded image/text dragging effect in .NET?

Ok, I know this is probably a pretty newb question, but when it comes to graphics programming, I am a newb :) How does Firefox achieve the drag and drop effect while displaying the nice faded copy of the selected image or text? See below for an example with the SO logo. Also, how could I reproduce this effect in C#/VB.NET? (preferably ...

Event for when the number of displays changes in .NET?

I have a program that needs to update some internal data structures when the number of attached displays changes, like when you put your laptop into the docking station and your dual monitors comes to life. Couple of questions in this regard: Is there such an event in .NET? If not, is there a windows message I can listen for? Will Scr...

Can I configure a .NET application to read settings from an SQL database?

I want my app.config (or my web.config for that matter) to read from an SQL database instead of an XML file. How can I do that? ...

Proper way to scan a range of IP addresses

Given a range of IP addresses entered by a user (through various means), I want to identify which of these machines have software running that I can talk to. Here's the basic process: Ping these addresses to find available machines Connect to a known socket on the available machines Send a message to the successfully established socke...

How do I debug random crashes in my web app in IE?

Here's a classic "works on my machine, but not in production" scenario. ASP.NET app written in C#. Simple UI with some items to select. Once the user clicks "Go", it runs to the server and builds a PDF file with some data-driven graphics in it (housed in SQL Server) and sends the PDF back to the user for use. I think it's a webserver i...

Unclear exception when compiling ASP.NET project

I have an asp.net application, with a number of referenced dll's. Now it seems when compiling the project I keep getting this one error: The specified module could not be found. Exception from HRESULT: 0x8007007E I See that one of the dll's that get referenced is the interop.dll, I suspect this error comes from the fact that intero...