.net

What can cause .NET assembly registration to fail?

We've seen an issue where one of our installers (msi) returns the error code 2908, which is used to indicate that an assembly failed to register. Later in the installation, we get the following (sanitized) error: MyAssemblyName, version="1.0.1.1", culture="neutral", publicKeyToken="119EFC79848A50". Please refer to Help and Sup...

.NET Development on a Mac Tips

I have just got a MacBook Pro and have been using it (+Fusion) to develop on for about a month now. The purpose of this question is similar to Hidden Features of C#; to become a how-to of tips and trick for windows development on a mac. I should clarify that I am aware of boot camp but do not use it (nor do I have any interest to), hen...

How to start using ndepend?

I recently downloaded ndepend and ran an analysis on an open source project I participate in. I did not now where to look next - a bit of visual and information overload and it turned out I don't even know where to start. Can anyone suggest starting points? What information should I look for first? What points out problems in the cod...

VB.NET Empty String Array

How can I create an empty one-dimensional string array? ...

Is there a plugin for targetting .NET 1.1 with VS 2008?

Question in the title... ...

Sending a mail as both HTML and Plain Text in .net

I'm sending mail from my C# Application, using the SmtpClient. Works great, but I have to decide if I want to send the mail as Plain Text or HTML. I wonder, is there a way to send both? I think that's called multipart. I googled a bit, but most examples essentially did not use SmtpClient but composed the whole SMTP-Body themselves, whic...

How can I determine whether a given date is in Daylight Saving Time for a given timezone in .NET 2.0?

I'm on .NET 2.0, running under Medium Trust (so TimeZoneInfo and the Registry are not allowed options). I'm asking the user for two dates and a time zone, and would really love to be able to automatically determine whether I need to adjust the time zone for DST. This probably isn't even a valid scenario unless I have some very robust...

Learning CIL

Does anybody know any good resources for learning how to program CIL with in-depth descriptions of commands, etc.? I have looked around but not found anything particularly good. ...

Will the GC call IDisposable.Dispose for me?

The .NET IDisposable Pattern implies that if you write a finalizer, and implement IDisposable, that your finalizer needs to explicitly call Dispose. This is logical, and is what I've always done in the rare situations where a finalizer is warranted. However, what happens if I just do this: class Foo : IDisposable { public void Dis...

What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database?

When executing SubmitChanges to the DataContext after updating a couple properties with a LINQ to SQL connection (against SQL Server Compact Edition) I get a "Row not found or changed." ChangeConflictException. var ctx = new Data.MobileServerDataDataContext(Common.DatabasePath); var deviceSessionRecord = ctx.Sessions.First(sess => sess....

Flex and .NET - What's a good way to get data into Flex, WebORB? Web Services?

Ok, I asked a question earlier about Flex and ADO.NET Data Services but didn't get much response so I thought I'd rephrase. Does anyone have any experience building Adobe Flex applications with a .NET back-end? If so, what architecture did you use and what third-party tools if any did you employ. I've read a little about doing Flex re...

What are you currently using for data access?

What particular method/application are you using to communicate between your application and a database? Custom code with stored procedures? SubSonic? nHibernate? Entity Framework? LINQ? ...

How to run NUnit v2.4.8 tests with NAnt 0.86 beta ?

I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled with the last stable version of NUnit (v2.4.8) without any success. The error I get is the following : [nunit2] Assembly "C:\Dev\MySample\bin\tests\My.Sample.Tests.dll" contains no tests. Of course, the assembly contains tests that I can run from any runn...

Determining members of local groups via C#

I wondered whether anybody knows how to obtain membership of local groups on a remote server programmatically via C#. Would this require administrator permissions? And if so is there any way to confirm the currently logged in user's membership (or not) of these groups? ...

Postback events from within DataView

I'm presenting information from a DataTable on my page and would like to add some sorting functionality which goes a bit beyond a straight forward column sort. As such I have been trying to place LinkButtons in the HeaderItems of my GridView which postback to functions that change session information before reloading the page. Clicking ...

How to do Streaming read of a large XML file in C# 3.5 ...

How can you do a streaming read on a large XML file that contains a xs:sequence just bellow root element, without loading the whole file into a XDocument instance in memory. ...

What is the best method of getting Int32 from first four bytes of GUID?

I'm just wondering if it exists better solution for this. BitConverter.ToInt32(sample_guid.ToByteArray(), 0) ...

Why doesn't C# support implied generic types on class constructors?

C# doesn't require you to specify a generic type parameter if the compiler can infer it, for instance: List<int> myInts = new List<int> {0,1,1, 2,3,5,8,13,21,34,55,89,144,233,377, 610,987,1597,2584,4181,6765}; //this statement is clunky List<string> myStrings = myInts. Select<int,string>( i => i.ToString() ). ToList<str...

Library or algorithm to explode an alphanumeric range

I was wondering if there is an open source library or algorithm that can expand a non-numeric range. For example, if you have 1A to 9A you should get 1A, 2A, 3A, 4A, 5A, 6A, 7A, 8A, 9A. I've tried Googling for this and the best I could come up with were Regex that would expand numerics with dashes (1-3 becoming 1,2,3). ...

Is there some way to compile a .NET application to native code?

What if I want to run a .NET application in a machine where the .NET framework is not available? Is there some way to compile the application to native code? ...