.net

.NET: How does the use of components in .NET differ to pre-.NET?

How does the use of components in .NET differ to pre-.NET? Are the differences as follows? .NET components don't have to be centrally registered on a machine and can merely be invoked at run-time from a specified location if .NET components are 'registered' in the GAC, problems associated with different versions of the same DLL ("DLL ...

Using the StackTrace Class in a production environment to get calling method info

hey guys We have a "log" class which uses Relection.MethodBase to send current class info to the log. The reflection.MethodBase stuff happens in the class itself. However, I'd like to move that stuff to a single external "log" singleton type class. In this scenario the external log class needs to get the CALLING info, not the current...

Continous Build Integration with SourceSafe and Batch Files

I want to create a continuous build integration system for .NET using just Windows batch files and Visual Source Safe. I've come up with the following batch file so far - set ssdir=\\xxxx\vss cd d:\mydir "C:\Program Files\Microsoft Visual SourceSafe\ss.exe" diff "$/sourcedir" -R -Q > diffout.txt This will spit out a file containg l...

.NET RegEx "Memory Leak" investigation

I recently looked into some .NET "memory leaks" (i.e. unexpected, lingering GC rooted objects) in a WinForms app. After loading and then closing a huge report, the memory usage did not drop as expected even after a couple of gen2 collections. Assuming that the reporting control was being kept alive by a stray event handler I cracked op...

General approaches to troubleshooting WebProxy issues

I have a .NET 2.0 Windows application that calls a .NET 1.1 web service. Users have an option of adding details of a proxy if required, along with any credentials and this proxy (a System.Net.WebProxy object) will be used when calling methods of the web service. I've instances where the proxy works for some users and not others (each us...

what's the UNC path for local computer from a remote machine ?

I am writing a small utility program in IronPython to install applications on remote machine using managementclass which uses WMI. Now, the script would install an application on Machine_B from Machine_A, it works fine as long as you have the msi file on the local drive of the Target machine (Machine_B, in this case). I want to be able ...

What's the difference between IEquatable and just overriding Object.Equals() ?

I want my Food class to be able to test whenever it is equal to another class. I will later use it against a List, and I want to use its List.Contains() method. Should I implement IEquatable or just override Object.Equals()? From MSDN: This method determines equality by using the default equality comparer, as defined by the objec...

While remote deubgging how are the pdb located (VS 2008)

When the deubgger is attached to a process on remote server - What locations are searched for the pdb? In what order? (e.g. is it searched on the remote server (debuggee) or on the local client (deubger)) When I use the deubgger to manually load pdb file from specific location - is the deubbger looking for the file locally or is it th...

is it incorrect to define an hashcode of an object as the sum, multiplication, whatever, of all class variables hashcodes?

Let's say I have the following class: class ABC { private int myInt = 1; private double myDouble = 2; private String myString = "123"; private SomeRandomClass1 myRandomClass1 = new ... private SomeRandomClass2 myRandomClass2 = new ... //pseudo code public int myHashCode() { return 37 * ...

Are there SqlExceptions which throw but commit their data anyway?

I've recently encountered the error: System.Data.SqlClient.SqlException: The transaction log for database 'mydatabase' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases on one of my windows services. It's supposed to retry after catching an Sql Exception, wha...

WCF - calling back to client (duplex ?)

Hi, I have a problem with what solution to choose.. I have a server running having a Service running that can receive orders from a website. To this server several client (remote computers) are connected somehow. I would really like to use WCF for all comunication, but not sure it's possible. I dont wanna configure all client firewall...

If we have too much commented code in .net would it effect code performance?

if we have too much commented code in .net would it effect code performance? ...

How to use ArrayList to store some data using ICollection

I want to store few strings into an array using ArrayList. How can I store all the strings at once without using Add function every time. Is it somewhat related to interface ICollection in anyway. Can I use ICollection to store my array. If yes How. ArrayList _1019=new ArrayList("TEN","ELEVEN","TWELVE","THIRTEEN","FOURTEEN","FIFTEEN"...

.NET: will Random.Random operate differently inside a static method

I am having difficulty with the following code which is inside a static method of a non-static class. int iRand; int rand; rand = new Random((int)DateTime.Now.Ticks); iRand = rand.Next(50000); The iRand number, along with some other values, are being inserted into a new row of an Access MDB table via OLEDB. The iRand number is being...

Uninstall out-of-browser silverlight application programmatically

How to uninstall out-of-browser silverlight 4 application programmatically instead of using the contextmenu (e.g. if I want to replace the context menu)? Edit I have found in "Installing Silverlight applications without the browser involved" how to uninstall by calling the command-line: "%ProgramFiles%\Microsoft Silverlight\sllaunc...

Nullable integer in .NET

what is the nullable integer and where can it be used? ...

How can I tell whether two .NET DLLs are the same?

I have the source for a DLL and I have a compiled version of it lying around somewhere. If I compile the source it will have a different date to the already-compiled version. How can I tell whether they are in fact the same and have merely been compiled at different times? ...

The benefits and hassles of moving entirely to a WPF Project

Hi, I have a project that i started as a WinForms application as that was the format i was confortable with at the time. I have since started dabbling in WPF an introduced some WPF UserControls (mainly grids) into my project and absolutely love them. The question i have is, is there any real advantage to me changing the UI Project of my...

Is it necessarily bad style to ignore the return value of a method

Let's say I have a C# method public void CheckXYZ(int xyz) { // do some operation with side effects } Elsewhere in the same class is another method public int GetCheckedXYZ(int xyz) { int abc; // functionally equivalent operation to CheckXYZ, // with additional side effect of assigning a value to abc return abc; // this value ...

BackgroundWorker not working with TeamCity NUnit runner

I'm using NUnit to test View Models in a WPF 3.5 application and I'm using the BackgroundWorker class to execute asynchronous commands.The unit test are running fine with the NUnit runner or ReSharper runner but fail on TeamCity 5.1 server. How is it implemented : I'm using a ViewModel property named IsBusy and set it to false on Backg...