.net

PrintCapabilities seemingly not returning all available capabilities

I'm trying to do some automated printing by using the PrintQueue class and printing XPS documents I have converted from word. Everything works fine, except for the fact that when I check the capabilities of the PrintQueue it returns NO stapling capabilities. This is not correct, as it is possible to open a word document and print it wi...

Does the .NET CLR do automatic inlining of properties?

Does the .NET CLR runtime know how to optimize/inline simple property getters at runtime? For example: property int Length { get; set; } Will this be executing the "Length__get" function (building a stack for it, jumping to execute the code, etc) once it is JIT'd at runtime? Or is the jitter smart, and knows that this can just be re...

.NET: Large revision numbers in AssemblyVersionAttribute

We have the convention of versioning our builds as [major].[minor].[micro].[revision], e.g. 2.1.2.33546. Our build-script automatically updates an AssemblyInfo.cs file containing [assembly: AssemblyVersion("x.y.z.w")] in order to embed the version-number in the assembly. But our Subversion-repository just reached revision #65535, w...

Multiple SQlCommand.ExecuteReader calls or do it once with datareader.NextResult()?

I'm using a SqlDataReader to populate an entity in a Winform app. The entity class has several foreign key attributes in the database that I want to setup as properties in the entity class. Each property will be of type 'Attribute' with an ID & Description property. Some of the users of the system are far from the database, so data acc...

How to avoid conflicts when using services? (.NET C#)

Imagine I have this class namespace CommonLibrary { public class Report() { public DateTime Begin { get; set; } public int Count { get; set; } } } This is the return type of a WCF Service method. When I use svcutil.exe it regenerates the class from metadata: namespace CommonLibrary { [System.Code...

Insert Space Between Pixels

I need to be able to draw a bitmap that is at a specific resolution (~40 DPI), on screen using GDI, and also be able to replicate spacing between each pixel. The space is a fraction of the pixel size, but it is noticeable to the eye. Is there anyway to setup the Graphics class or a Bitmap to have it insert "white space" between drawn p...

What happens in 'assembly purgatory'?

When a .NET assembly is deployed to the GAC and the destination file is locked, Windows holds it in what I can best guess is some sort of 'assembly purgatory' - c:\windows\assembly\temp. Using Process Explorer these can easily be seen when searching for the suspect DLL: As soon as I end the process locking the file (in this case OWST...

Will an exception created during rollback logic within another catch wipeout the stack trace of the original exception?

I have a method that A) inserts a row in a table and then B) uses the resulting Identity value in several inserts in another table. If the logic in part B fails for any reason, I need to rollback all of the inserts for both parts B and A. I'm fairly certain that transactions would not work for this, although I'm open to being persuaded...

File encryption library for .NET

I'm looking for a file encryption library under .NET. It needs to be able to seek so CryptoStream is out of question. (I know it inherits a Seek method but it's not implemented.) I need to seek because my application deals with large files in a non-sequential order. I also need to read and write the files at the same time. I know that...

Web Add-in for TFS Installation Problem

I am creating a simple web app for TFS2008, so I am using the "Microsoft.TeamFoundation.*" assemblies to access TFS. Everything was working really great until I decided to move it from my machine to a separate Win2003 server. In fact, it was a clean server with latest updates applied. So, I copied my application's binaries and tried t...

Sizes of structs on 32 bit and 64 bit

In the .NET struct design guidelines, it gives the maximum sensible size of a struct as 16 bytes. How do you determine how large your struct is, and is it affected by the architecture your program is running on? Is this value 32-bit only, or for both archs? ...

C# non-boxing conversion of generic enum to int?

Given a generic parameter TEnum which always will be an enum type, is there any way to cast from TEnum to int without boxing/unboxing? See this example code. This will box/unbox the value unnecessarily. private int Foo<TEnum>(TEnum value) where TEnum : struct // C# does not allow enum constraint { return (int) (ValueType) val...

Oscilloscope UserControl for .net

I'm looking for a way to paint real time measurement data as a curve in a WinForms app. Here is an example of something quite close to what I'm looking for. But is there something more modular out there? ...

Strongly typed dataset wont fill, table mappings problem? c#.net 2.0

Hello all, You've been excellent with my other questions previously - so here I am again, in need of some help! I've got a query which joins three tables and a strongly typed dataset which has the columns defined for everything which comes back from the query. When I go to fill the dataadapter, nothing gets filled. I've copied the co...

.Net framework 2.0 Configuration Tool

I recently installed windows 7, visual studio 2008, and .net framework 3.5. With these installed, I was unable to find the .net framework configuration tool. It should be located in %windir%\Microsoft.net\framework\v2.0.507727\ with the file name mscorcfg.msc The only place I found something similar is in %windir%\Microsoft.net\fr...

Reading settings from app.config or web.config in .net

I'm working on a C# class library that needs to be able to read settings the web.config or app.config file (depending on whether the DLL is referenced from an ASP.NET web application or a Windows Forms application). I've found that ConfigurationSettings.AppSettings.Get("MySetting") works, but that code has been marked as deprecated by M...

Using .Net 3.5 assemblies SQL 2005 CLR?

I have a CLR stored procedure that references an assembly created in VS 2008 that uses Linq. Lets call this assembly 'MyLib'. I can't seem to get 'MyLib' into my SQL 2005 database. I do the following: CREATE ASSEMBLY [MyLib] FROM 'C:\MyLib\bin\Release\MyLib.dll' WITH PERMISSION_SET = UNSAFE GO But I get the error: Assembly 'My...

CSV File read. Special Chars problem.

Hi guys. I have to edit a csv file, the problem is that my special chars like ó ã ç gets screwed up. Heres is a peice of my code: static void ReadFromFile(){ StreamReader SR = new StreamReader("c:\\Users\\Levy\\Documents\\Vale\\Base\\Desknote.csv", Encoding.Default); StreamWriter SW = new StreamWriter("c:\\Users\\Levy...

DataGridView AutoGenerateColumns is set to true somehow

Hello, I derive DataGridViewEx class from DataGridView like this: public class DataGridViewEx : DataGridView { // ... [DefaultValue(false)] [Browsable(true)] public new bool AutoGenerateColumns { get { return base.AutoGenerateColumns; } set { base.AutoGenerateColumns = value; } } public DataGridViewEx() { AutoGenerateCo...

Complete Http Library

Hi, I am looking for an http library (for c# program) that will allow me to download some html documents from the web. i am aware to the HttpWebRequest object and the other options that provided by the .NET library, however, i need more complete solution that would be able to handle different document encodings (sometimes the encoding i...