.net

Does .NET 3.5 allows to use the new features of Windows 7?

Some of the applications running on Windows 7 (Internet Explorer, Google Chrome, in example) use the icon they present in the task bar to show a little progress bar. Is it possible to use that feature using the .NET Framework 3.5? ...

Display a single object with a DataGridView.DataSource

I'm used to display multiple objects with a DataGridView control in the following format ID Name Address [...] ID1 Name1 123 street [...] ID2 Name2 456 street [...] This is simple to do with objects, properties and a BindingList<>. I'd like my data to be "rotated" 90 degrees so that the grid displays a ke...

How to identify which framework an assembly is loaded in?

A user reported to us that some strange behaviour in our application can be resolved after installing .NET 4: <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v2.0.50727" /> </startup> </configuration> I wasn't aware that if you didn't specify an assembly it might be loaded in a high...

Is it possible to post system exception in the culture of my choice?

For example, my asp.net application has a user which has an account number, name, address and a culture. I know exceptions should rarely be shown to the user. But lets say I do want to use this framework exception message localized, is it possible? something like catch(Exception ex) { ex.ShowLocalizedMessage(myCurrentUser.CurrentCul...

How do I catch FileNotFoundException when running on Mono and a DLL is missing?

I have a windows 7 x64 desktop with vs2010 and a virtual box installation of linux with mono and monodevelop. I compile the following program with vs2010 and run it in the linux virtual machine and it fails with a seemingly uncatchable FileNotFoundException. If I compile it in the virtual machine and run it in windows, it works great. ...

.NET Binary File Read Performance

I have a very large set of binary files where several thousand raw frames of video are being sequentially read and processed, and I’m now looking to optimize it as it appears to be more CPU-bound than I/O-bound. The frames are currently being read in this manner, and I suspect this is the biggest culprit: private byte[] frameBuf; Bin...

How do I configure IIS or the web server to allow it to read and write files?

I'm trying to add functionality to a simple web service that will allow me to log information to an XML file on the hard drive where the application is located. When I employ the functionality in a Console version of the application, the data gets logged to: bin\x86\Debug MySolution.MyProject\MessageLog\TestMessagess.xml. However, w...

LINQ casting with a Data.DataTableCollection

I have the following VB.NET code that I am using to sort a Data.DataTable by column count. For Each dtTarget As Data.DataTable In _ From x In Target.Tables _ Where DirectCast(x, Data.DataTable).Rows.Count > 0 _ Order By DirectCast(x, Data.DataTable).Columns.Count ... Next Is there a way to indicate that x is a Data.DataTab...

Self Tracking Entities - Deleting from Navigation Property does not set state to 'Deleted'

In the constructor of each of my POCO's I have this: this.StartTracking(); To ensure that tracking is turned on for every instance of one of my POCO's. I have an Entity A which contains a TrackableCollection of Entity B. When I load my instance of Entity A like such: using(MyContext ctx = new MyContext()) { entityA = ctx.EntityA....

Query count in .net

I'd like to do something similar to http://stackoverflow.com/questions/2116960/queries-count-for-page-in-asp-net-mvc - namely count the number of SQL queries executed in a particular request, and time them. The difference is, I don't have a standard method that all SQL queries are routed through - I need a method for intercepting all ca...

Socket.SendAsync does not detect dead TCP connection

Hi, I'm having an issue with the Socket.SendAsync method not detecting a dead TCP connection. In my client/server app, the server is sending heartbeats to connected clients in regular intervals. The issue that I'm experiencing is that even though the client might be dead, the callbacks from the SendAsync method indicate "SocketError....

Building a Generic Parser for Converting a Text File to a Data Structure in C#

I have a definition for a SPAN file (http://www.cme-ch.com/span/spanl300.htm) that i'd like to use in constructing a parser to parse the string data into an in memory collection class (or even using lazy evalution with the yield keyword.) All parsing techniques and libraries i've seen apply to constructing parse trees for implementing...

"Method is not supported" error when trying to invoke a delegate

I have a function Run(string, string[]) which I want to run on a separate thread, so I am using a delegate and BeginInvoke: private Func<string, string[], Stack<StackItem>> runner; public MainPage() { runner = Run; } private void btnStep_Click(object sender, RoutedEventArgs e) { // snip runner.BeginInvoke(tbCode.Text, GetA...

What scripting language for our .NET based IDE

We have an IDE for machine automation that allows its users to develop solutions by connecting objects and components visually. They can also write "plugins" using c++ and c#. The IDE is written using .NET. Its users often are not founded in traditional software development and programming but more in the direction of technical/electrica...

Add / remove logfiles during runtime in NLog

Hi, I'm writing a small file conversion utility. Files get automatically converted when they are dropped into a directory. I'm using NLog for logging. Besides a central log file which is configured using NLog.conf (and which receives all messages generated), I'd like to create one additional log file for each input file, having a simil...

The Ultimate Visual Studio Solution Structure

Realizing that this could be subjective based on the project at hand, I'm looking for the "best practice" method of structuring a VS Solution. Please feel free to edit this, comment on what you think might be incorrect, suggest alternatives, etc. I'd love to see this CW grow into a great resource for people just starting with VS Soluti...

.NET - Is there the attribute [DataContract] for a Web Service?

note that I am not using WCF, i'm only using ASP.NET web service. Anything similar? Thank you. ...

How do you load a dictionary into a console application from an app.config?

I want to load a dictionary at startup in my console app from my app.config. I know that I could use an xml library or linq to XML to load it to parse and traverse it. My question is there a BUILT IN way of doing it. Isn't there some way to add an application configuration section into the app.config and then have it loaded automagi...

Why is there an F# Runtime being installed with Visual Studio 2010?

I'm installing Visual Studio 2010 on a new machine and took a list of the default Components installed. Among them, there is 'Visual Studio F# 2.0 Runtime', which seems strange, because as far as I knew, all .NET languages get compiled to MSIL and are then treated equally (this is obviously not right, since there is a F# Runtime). So h...

How do I read a settings value from the web.config file in an ASP.NET application?

I'm trying to use the following command: Dim xmlFilePath As String = _ System.Configuration.ConfigurationManager.AppSettings("XmlFilePath") to retrieve the following setting: <applicationSettings> <MySolution.WebProject.My.MySettings> <setting name="XmlFilePath" serializeAs="String"> <value>C:\ASP.NET\Fold...