.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries for the ‘Collections’ Category

CG5: Standard Catalog for Clip Art May Be Unavailable in Clip Gallery

Symptoms
When you use Microsoft Clip Gallery 5.0, you may notice that some clip art is missing that had been available in the past.
Resolution
This problem can occur when you install Microsoft Publisher 2000 and one or more of the following Microsoft programs:PhotoDraw 2000Home Publishing 2000Greetings 2000All of these other programs install some of the same collections as does Publisher 2000, but the programs are installed into different folder locations. These collections are called catalogs. The problem occurs when the path to one or more of the collections becomes invalid.
A path to the Clip Gallery catalog can become invalid if one or more of these programs are removed without using the correct uninstall process.

Cannot View Subcollections on Child Sites

Symptoms
When you view subcollections on child sites, some subcollections may be shown in the Systems Management Server (SMS) Administrator console, and others may not appear. For example, one child site may have a specific subcollection, while another child site does not. Note that the missing subcollections are the subcollections that are created from a parent site, not those that are created locally to the child site.
Resolution
The SMS Administrator console only presents collections that are defined both in the Collections and Collection_SubCollections SQL tables. Because of timing issues, SMS Collection Evaluator and SQL Monitor may not correctly update both tables.

BUG: XmlTextReader Decodes URLs Before Downloading Resources Resulting in Unpredictable Behavior

Symptoms
When you use the XmlTextReader object to download resource files, the reader decodes the URL for the resources. If the URL contains any special characters (for example, ampersands or percent signs), this may result in unpredictable behavior.
Resolution
To resolve the problem, follow these steps: Use the XmlUrlResolver and the System.IO.Stream classes to map the specified URL.Create an XmlTextReader object and pass the Stream as the parameter. For an example, see the “More Information” section of this article.

BUG: The System.Collections.Queue.Clone method loses data while cloning objects

Symptoms
The Queue class is a Microsoft .NET Framework Class Library class. It represents a first-in, first-out collection of objects. However, if you use the Queue.Clone method to clone a queue, and if the call to the Queue.Dequeue method is made before the call to Queue.Clone method is made, the data is lost.
Resolution
A bounded buffer is used to implement the Queue class. The Clone method uses the beginning of the buffer, instead of the head pointer, as the starting point. When the Dequeue method is called, the first element is removed. However, the beginning of the buffer remains the same. Therefore, the first element appears as an empty element and the last element is lost in the cloning process.

BUG: Removing Collection Elements Takes Longer Than Expected

Symptoms
In Visual Basic 6.0, removing elements from the end of a collection takeslonger than removing elements from the beginning.
Resolution
When removing an element from a collection, Visual Basic 6.0 begins at thebeginning of the collection and traverses the collection until the desiredelement is reached, then that element is removed.

BUG: Assignment of Multi-Valued Objects in Request Object Causes Corruption in Scripting Dictionary

Symptoms
If items in the Request.Form or Request.QueryString collections that contain multiple values are assigned to a Scripting Dictionary object stored in the Session object, data corruption may occur. Corrupted data will manifest either as empty fields (that is, blank individual dictionary items) or items that contain garbage text.
A common example of this is a checkbox; checkbox controls can have the same name so that multiple values of a single named item can be returned to the server.
Resolution
When the assignment of a multi-valued item in the Request.QueryString or Request.Form collections to an item in the Scripting Dictionary object takes place without explicitly using the Item property of the object within the collection, a reference to the actual object is stored in the Scripting Dictionary instead of the intended value. This means that when the item stored in the Scripting Dictionary is referenced again, the Scripting Dictionary will refrence an object in the Request.QueryString or Request.Form collections instead of the intended string or integer values.