The Story Behind the Answer:

I don't know if this will apply to more than Visual Studio 2012, but if it does, fantastic; please let us know in the comments.

A few days ago, my Visual Studio 2012 went wonky and decided to not show me the Available Processes in the "Attach to Process" dialog in most cases.

Here is what it should look like:

Here is what it looks like when the problem occurs. Notice how, if I hover inside it, it will show me the tooltip for the process I'm currently over. This suggests the list is actually populated, and double-clicking on that spot will actually make the debugger try to attach to it. The information is there; the questions are, "Is it white font on white background?" or "Is there some other kind of painting/rendering issue with the dialog box?"

Looking around the internet, I could not seem to find the right phrase to search to find help with this issue; until I finally stumbled upon this StackOverflow question that was as close as I could get. One answer suggested renaming MSVSMON.EXE in the x64 folder and copying the x86 version to it.

Not feeling comfortable with that, I decided to experiment with a similar concept. I opened Task Manager and saw that msvsmon.exe was a running process.

I executed an "End Task" on the process, and was met with this error:

Going back to my already open "Attach to Process" dialog, I clicked "Refresh" and BAM! ... there appeared the visible list.

I have done this several times, each time resulting in success. I hope it works for you!

2015-07-03

I ran into a weird one today when working with a Data Dynamics Report (DDR) that needed sorting enabled on the column headers of a table. Each of the TextBox controls in the column header cells were set to CanGrow=True, which was good to make sure each could fit their content. Width was forced, so the only way for it to grow was in height. It worked great until I enabled sorting.

Each column cell required sorting, so I added the SortExpression to each accordingly. The instant I brought up the report in the WebReportViewer, it looked like the heights of the header cells were twice as tall as needed to fill the largest content of any of the given cells.

I then reverted my changes and the height went back to normal, making the height of the table row equal to the cell with the most content in it. I deduced that DDR was computing height based on the extra sorting control being added to each cell, but somehow was calculating too much. As I changed strings, the height would grow relative to the amount of content in the cell... so if the string was longer, the cell would grow all the more tall; looking double what the content in the cell was taking in height.

As I was about to give up and disable sorting on the report because the headers were taking up 1/3 of the page, I decided to try an experiment.

I turned CanGrow=False on every one of the column headers' TextBox controls (leaving the sorting enabled.) The height went down to minimal, where only one line of text would show, and the rest was hidden because the row wasn't tall enough. Great. I have a baseline now!

The next step was to try changing CanGrow=True only on the cell I knew would have the most content in it.
Win!

So if you run into a similar issue, try the following:

Change CanGrow=False on all TextBox controls in your column headers, except the cell you know will have the largest content.

2014-07-25

The ActiveReports engine is a great engine for rendering reports for an application. Sometimes, though, errors will occur that have multiple reasons for why they show up; some known, others not.

It's very hard to troubleshoot those or to find solutions for them, even if you have incredible internet search skills. That said, this solution may not work for you, but hopefully will give you a quick test to see if you can move on to another suggestion.

I was puzzled while trying to solve a problem we had in our web application where exporting via ActiveReports 8 WebViewer to PDF or DOC worked fine, but XLS for some reason returned a 404 error.

The problem turned out to be with mine that we missed laying down a DLL required by the Excel exporter (GrapeCity.ActiveReports.Export.Excel.v8.dll) called DocumentFormat.OpenXml.dll, which didn't seem to be referenced by the other Export DLLs.

As soon as I put this in place, it started working again.

This file could be easily missed as it is not named like the other export related DLLs:

GrapeCity.ActiveReports.Export.*.v8.dll

Make sure to include that and you'll have one less reason to see a 404 error when you try exporting to Excel from ActiveReports!

On a side note, the following are all of the referenced DLLs (Microsoft DLLs excluded) for GrapeCity.ActiveReports.Export.Excel.dll in case you need to check for others also missing:

2013-08-28

I struggled for a couple of hours on this one... until finally finding this useful answer from stackoverflow.com! My scenario was needing to copy some files in a pre-build step in a Visual Studio C# project. For every file I needed to copy, there was a counterpart for each of our supported languages. The naming convention for the files was like this:

After attempting multiple combinations of wildcard patterns and having no success, I changed the search phrases I used to search the internet and found the stackoverflow thread.
The most important part from the thread, and the most important thing to remember about using Include and Exclude is:

If you use an absolute path for Include, you must use an absolute path for Exclude. If you use a relative path for Include, you must use a relative path for both.

2013-08-09

The ObservableCollection<T>.CollectionChanged event will only fire if the collection itself changes (items are added, removed or rearranged/moved.), NOT if an item in the collection changes (meaning one of the item's in the collection has one or more properties modified.)

It's now around 2:30am, and I've been going the rounds for a couple of hours with a Silverlight project at work; fighting a seemingly simple change that ended up not being so simple because of a major misunderstanding of the CollectionChanged event on the ObservableCollection<T>. My ObservableCollection<T>.CollectionChanged event was not firing like I thought it should.

I imagine this will be a common mistake for others, and I'm sure I myself am doomed to repeat it again in the future; so I'm documenting it for a quick reminder later.

My thought process was this... "I need to watch my ObservableCollection for one of its items to be changed. Once the item is changed, I need to flip a boolean flag which happens to be bound to a command which will disable a button after the change has been made."

Simple, right?
I should just be able to handle the ObservableCollection<T>.CollectionChanged event, because if one of those items in the collection gets changed, that counts...

Or not.

See, the misconception is, the collection itself hasn't changed. It has the exact same items it had before, it's just that the item within the collection changed. So there are two things that can happen to your collection:

The collection itself is modified (Items are added, removed or moved.)

An item in the collection is modified (its individual properties are changed.)

Let me illustrate:
For this example we will have a class called VideoGame to keep track of titles and costs.

ObservableCollection<VideoGame> videoGames = new ObservableCollection<VideoGame>
{
new VideoGame{ Title = "TrackMania 2: Stadium", Cost = 9.99M },
new VideoGame{ Title = "TrackMania 2: Canyon", Cost = 19.99M },
new VideoGame{ Title = "TrackMania 2: Valley", Cost = 19.99M },
};
videoGames.CollectionChanged += (sender, eventArgs) => {
Debug.WriteLine("--- The collection changed");
};
Debug.WriteLine("Changing the cost of one of the video games in the collection...");
// The CollectionChanged event will not fire because it was just one of the collection's items that changed...
// not the collection itself.
videoGames[0].Cost = 7.99M; // the game went on sale.
Debug.WriteLine("Adding a video game to the collection...");
// The CollectionChanged event WILL fire because the collection of items changed.
videoGames.Add(new VideoGame{ Title ="ShootMania: Storm", Cost = 19.99M });

And the output...

Changing the cost of one of the video games in the collection...Adding a video game to the collection...--- The collection changed

When it dawned on me, at first I was frustrated; but then clarity set in. It makes sense to me that we only want the CollectionChanged event to fire when the collection itself is modified, not its individual parts. With it, the NotifyCollectionChangedEventArgs that are passed with the event give us a lot of good information about what happened with the change.

While all this is cool, what do I need to have happen so I can track when an item in the collection is changed?

I need to make sure I handle PropertyChanged on the individual items of the collection. Make note, this can be tricky because I still need to watch for the Collection to change so I can subscribe to any new items' PropertyChanged events as they are added to the collection, and clean up after myself when the items leave the collection.

I'll let you decide how you're going to approach that; it's a discussion for another day. But I want to drive home the concept that the CollectionChanged event is just that... when the collection itself changes, not its individual items. Know that, and you'll save yourself a lot of time.

2012-09-29

I love LINQ. LINQ is just fun to use. I love the fact that I can query the same way across databases, XML documents and objects (alright XML is slightly different, but...)

Today I had the task of querying down a complex set of objects that each own a collection data member. I needed to get to some data 4-layers deep and thought the LINQ query would get pretty nasty. That is until I learned that I can use the "from" keyword multiple times in the same LINQ query.

My example will be very contrived to save having to look at a lot of extra code for different collections, so I'll go ahead and just nest the same collection several layers down, just so we get the concept.

IEnumerable<Person> grandChildrenWithHighIQ = from grandpa in grandpas
from parent in grandpa.Children
from grandkid in parent.Children
where
grandkid.IQ > 100
select grandkid;

Now we know longer need be afraid of querying complex objects and getting the data we want. Write your queries in the bLINQ of an eye, and get your data back even faster!

And I'll put a shameless plug out there for LINQPad since I took a screenshot from its results above. It is a fantastic tool for crafting LINQ queries and is a wonderful sandbox for small .NET proof-of-concept projects because you can write small programs without creating a Visual Studio project or solution.

2012-08-29

Note: This may be fixed in a later version of Telerik controls; this issue was discovered in the Telerik.Windows.Controls library; version 2011.1.315.1040
Working on a Silverlight application, we found ourselves with some dialogs that utilize the Telerik RadNumericUpDown control. We discovered a defect when binding the Value property of the control to a ViewModel behind the scenes.

The original binding works as expected, and if the spinner controls are used to change the value, the ViewModel updates as we expect. If a user types a new value into the control it also updated the binding on the ViewModel correctly.

The problem arises when we blank out the value by clicking into the textbox portion of the control, highlighting it and hitting the Backspace or Delete key. Removing focus from the control or not, the ViewModel property bound to that control does not get updated.

This makes the behavior act the same as if the user had used the down spinner on the control to modify the value down to the minimum.

This may not be the ideal solution for you, but understanding this will give you direction on how you can create your own workaround. We started down the path of handling the KeyUp event, but ValueChanged seems much more appropriate.

Telerik makes fantastic controls; and I'm not mad by any means. Being a developer myself, I realize these things happen; but I do hope they have handled this better in a later release. And as far as I know this is the only control in the 2011.1.315.1040 version that has this issue.

I asked friends on external networks to bring my site up in their browsers and they could hit it fine on the non-standard port, so I knew my firewall and IIS Express were configured correctly.

I cannot find anywhere in PayPal's documentation where it states that port 80 is required but it seems their own firewall is pretty strict with outbound traffic. Once I forced my router to listen on port 80, and forward the request to the non-standard port my site listens on, the simulator worked like a champ.

So, if you're having problems with the IPN simulator not sending to your listener and you are listening on a non-standard port, make sure to do one of the following:

Force your router to listen on port 80, but forward to the port your test site is set up on.

That's what we like to see!

As a side note, if I remember correctly... the standard ASP.NET Development Server (Cassini) that comes with Visual Studio, does not accept requests from an external network. I believe it can only accept them from the same machine you are doing the development on. This is why I opted to use IIS Express.

Hope this saves someone else some time and head-banging on your desk. :)