Skip to main content

Tim's Blog

Go Search
Tim's Blog
  

Categories
Work
Personal
Other
Other Blogs
There are no items in this list.
Writing code is good exercise.
SharePoint and IE error: “Error in Loading DLL”

Just recently, I began getting a JavaScript error whenever I browse our company's SharePoint 2003 and 2007-driven sites. This is the error I was receiving:

Error in loading DLL

No one else in the company seemed to be having the same problem, so I doubt it was caused by a Windows Update. I can think of two possible culprits:

  • I recently uninstalled SilverLight 2 Beta 2 and the Visual Studio tools + Expression products, and installed a SilverLight release candidate.
  • I recently added Visual Basic to my Visual Studio 2008 Team Suite installation, and re-applied SP1 for VS 2008.

I was also receiving this error on my blog when clicking the link to "Launch blog program to post."

This feature requires Microsoft Internet Explorer 6.0 or later and a Windows SharePoint Services-compatible blog editor such as Microsoft Office Word 2007 or later.

This message is very strange since I'm browsing with IE 7.

It turns out that the solution to the problem was to repair my Microsoft Office 2007 installation. I suspect that the installation of one of the SharePoint ActiveX components (see Jose Baretto's Blog) had become corrupted somehow. My guess is that Stssync, the component used to synchronize Outlook to SharePoint lists, was the culprit, but this is just a wild guess.

Entity Framework RTM Installation Experience

If you haven't been paying much attention to the release schedule of the Microsoft ADO.NET Entity Framework, you might not even know that it was finally released with SP1 of Visual Studio 2008. Having stirred up so much controversy among ORM enthusiasts, I was hoping for some election-year-worthy rhetoric and hyperbole from its critics, and either a flurry of praise or complaints from EF-user-hopefuls. Its release, however, was eerily quiet. I guess we'll just have to wait and see what comes up.

I was curious to see how the SP1 installation affected my existing EF Beta 2 installation and applications, so I installed SP1 without uninstalling EF Beta 2. The first thing I noticed when attempting to create a new Entity Data Model in a new application was this message:

Error: this template attempted to load an untrusted component 'Microsoft.Data.Entity.Design, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.  For more information on this problem and how to enable this template, please see documentation on Customizing Project Templates.

I had to double-take to see that I actually have two "ADO.NET Entity Data Model" templates in the Add New Item dialog. One of templates causes the error and the other one does not.

This is obviously because I had not uninstalled EF Beta 2. To fix this problem, uninstall the following programs:

  1. ADO.NET Entity Framework Tools Preview
  2. ADO.NET Entity Framework 1.0 (Pre-Release Version) (not really required to fix this issue, but it should be uninstalled anyway)

Next, I tried opening and running an old EF Beta 2 demo application I wrote. When attempting to open the .edmx file in the designer, I received the following error:

"Error 5: The required attribute 'Provider' is missing."

Similarly, attempting to build the solution gave me this error:

"Schema specified is not valid. Errors: Rockstars.ssdl(2,2) : error 0005: The required attribute 'Provider' is missing."

Apparently, the storage model (SSDL) schema has changed a bit. To fix the problem, I found the edmx:StorageModels element in my .edmx file and edited the code as shown below. (You may need to right-click on the .edmx file in Solution Explorer, and choose Open With --> XML Editor.)

From this:

<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="RockstarsModel.Store" Alias="Self" ProviderManifestToken="09.00.3054" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">

to this:

<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="RockstarsModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">

The other build error I was receiving was this:

"The type or namespace name 'RockstarsModel' could not be found (are you missing a using directive or an assembly reference?)" (In case you haven't figured it out yet, my program is called "Rockstars.")

This is due to a change in the way the generated data classes are namespaced. Previously, the generated data classes were placed in a top-level "model" namespace to represent the conceptual model (CSDL). This namespace had to be imported (or classes fully-qualified in code) in order to consume the data classes. In the RTM version, the classes are generated in your solution's default top-level namespace, so no import is necessary. The code gets re-generated at almost every move, so your old project will get updated to the new namespace pattern.

To fix my error I removed this line of code:

using RockstarsModel;

The most touted new feature in the RTM is the EntityDataSource. I'm a little skeptical that it's just another wizard, but hopefully I'll get a chance to look at it and blog about it. Other changes that may be of interest can be read about here. Some that caught my eye are:

  • In the SSDL (store definition), you can no longer use a period in the name of an Entity, Association, EntityContainer, EntitySet, AssociationSet, or Function.
  • The public DisposeContext() method has been removed from the EntityDataSourceView class.
  • The event argument classes for the EntityDataSource have been re-architected. This affects ASP.NET users who used the ContextCreating, ContextCreated, ContextDisposing, Selecting, Selected, Updating, Inserting, Deleting, and Deleted events.

All in all, the installation was pretty smooth, and migrating my Beta 2 application was pretty simple.

Thoughts on the Entity Framework Vote of No Confidence

I'm far from an expert on Microsoft's Entity Framework (EF), but I have dabbled a bit with betas 2 and 3. Recently, Brian Ellis, a colleague of mine, summarized the points made in an open letter claiming a "vote of no confidence" in the Entity Framework. I'm no ORM guru or EF junkie, but I know enough about EF to see that it has both potential and limitations. I'd like to share my thoughts on the letter.

To be fair, I've never used NHibernate (the Holy Grail), and work primarily with Microsoft technology. That doesn't make me an EF evangelist. I'm still quite skeptical, but interested in understanding the value of the technology.

Before getting into the issues mentioned in the open letter, I would like to add a few gripes of my own:

  • The design surface is not feasible for maintaining hundreds of entities.
  • The mapping seems to be brittle when using the designer for custom entities, including the refresh from schema feature.
  • The designer forces the developer to refresh from schema in certain cases, when perhaps she doesn't want to.
  • Generated code in an entity data model does not represent self-referencing schema very well (for instance, an Employee that inherits from Person, which has a Manager property that also inherits from Person). Customizations required to work around the issue are hard to maintain.

I'm sure the more I use it, the more gripes I'll have, but for now let's get to the gripes of the open letter.

 

INORDINATE FOCUS [ON] THE DATA ASPECT OF ENTITIES LEADS TO DEGRADED ENTITY ARCHITECTURES

Regarding the point that entities are tied too closely to schema, I believe this is often true, but only because unmodified, generated code is the simplest and most common way to build an entity model—straight from schema. They don't have to be, however. From my understanding, a decent amount of flexibility is provided for structuring entities and their relationships, included multiple inheritance patterns, and the ability to group mapped columns into complex object properties.

(For instance, a Person table may contain several columns related to addresses. You could create a complex type called Address that a Person entity uses, and map the properties of the Address property to the columns in the Person table. No Address table is required in the data store, just proper mapping.) I'm sure, however, that many entity models would be very difficult, or impossible, to map using EF.

Regarding the point that entities are data-centric, rather than behavior-centric, I might not fully understand the complaint. The authors make no mention of the fact that the entities are partial classes with full exposure to the EF's data access gateway, allowing custom business and data access logic to be attached to each entity. (They do mention the partial class architecture in the "persistence ignorant" section, but only to complain of its "awkwardness.") It seems to me that custom entities could be designed with behavior in mind.

EXCESS CODE NEEDED TO DEAL WITH LACK OF LAZY LOADING

EF supports deferred loading, but requires the developer to understand when any related entities ("navigation properties") are loaded, rather than automatically fetching & load-tracking when referenced. It's true, this causes the developer to ask IsLoaded() of an entity's navigation properties, and then conditionally Load(). You can also eagerly fetch navigation properties when fetching the parent by using the .Include() method, but this is pretty much the opposite of lazy loading. It sounds like the authors of the letter do not want developers to need to understand when or if a property has already been loaded. I don't really have an opinion on this since this requirement hasn't given me enough heartburn to gripe about it.

SHARED, CANONICAL MODEL CONTRADICTS SOFTWARE BEST PRACTICES

If I understand correctly, the authors of the letter are proponents of separate models per application tied to a single data store, rather than a single, canonical, model shared by multiple applications. This seems fully feasible with EF—there's no reason multiple models could not represent and access the same data store. Am I missing something?

Even better in certain cases, it seems possible with EF to place all core, sharable logic in a shared entity model, and have application-specific logic in each application that consumes the model. This architecture would probably break the partial class pattern of putting the logic directly in the entity, but if the logic is application-specific, I don't think it belongs there anyway. This could be handled with a more classically-tiered approach using service layers or business layers in consuming applications.

LACK OF PERSISTENCE IGNORANCE CAUSES BUSINESS LOGIC TO BE HARDER TO READ, WRITE, AND MODIFY, CAUSING DEVELOPMENT AND MAINTENANCE COSTS TO INCREASE AT AN EXAGGERATED RATE

I think this is a little misleading, because the entities themselves are persistence-ignorant, but obviously the mapping configuration cannot be. Perhaps I'm missing something, but that seems to be the nature of ORM. In order to connect an entity data model to two completely different data stores (in schema, technology, etc.), you would have to take great care in creating two separate mapping configurations to ensure they provide equivalent mapping. Even then, you are limited by the differences in what the two data stores support. For instance, you can't expect an XML file to support cascading deletes or other features that SQL Server provides. However, if we ignore the differences in the features of data store technologies and focus solely on mapping, I believe the EF supports persistence-ignorant consumption of entities, allowing for unit testing, data migration, etc.

EXCESSIVE MERGE CONFLICTS WITH SOURCE CONTROL IN TEAM ENVIRONMENTS

This wouldn't surprise me, but I have no experience with EF in source control.

 

In summary, I feel like the open letter attempts to make some good points, but doesn't do much to back them up. It also seems that certain features of EF are glossed over, or perhaps EF is just not enough like NHibernate for those that wish it was. I'm not an EF evangelist, and I'm sure when it's finally released it will stir up a lot of complaints (by me, included), but this letter smells a bit like alt.net vs. MSFT to me.

 

 

Uninstalling MSDN Library for Visual Studio 2008

I'm in the process of installing the RTM version of Visual Studio 2008, and needed to uninstall a RC version in order to do so. There are some good blog posts out there outlining the steps required to make this work. (I believe Jon Galloway's is the most thorough.)

Unfortunately, however, I was not able to complete even the very first step, which was to uninstall the MSDN Library for Visual Studio 2008. Each time I attempted to uninstall it, I would get the following error: "A problem has been encountered while loading the setup components. Canceling setup."

I found the answer to my struggles in this blog post. He says to use CCleaner to launch the MSDN uninstaller. As he claims, it "works like a charm."

Web pages cannot be accessed from another machine

I recently discovered that web sites hosted on my dev box (Vista Enterprise, IIS 7.0) could not be accessed from any external machine. I'm not exactly sure when or how it happened, but it used to work, and then at some point it stopped working. My suspicion is that perhaps installing Orcas (Visual Studio 2008) Beta 2 had caused a setting to change, but that's just a guess.

After poking around IIS, directory security settings and Windows Firewall, I found the setting that had been mysteriously flipped. If you run into this issue, you might give this a shot.

  1. Open Windows Firewall with Advanced Security
  2. Select "Inbound Rules"
  3. Find "World Wide Web Services HTTP Traffic In"
  4. If Enabled = No, change it to Enabled = Yes.

“Show Checkboxes” feature in NUnit

Lately, I've been using a nice feature in NUnit that not everyone knows about – "Show Checkboxes." Why? Because checkboxes are good. When given the option, we should always… show them.

"How can I show these checkboxes?" you ask. "I like checkboxes as much as the next guy. I want to show them!"

The answer is simple. Navigate, using the View menu, to Tree-->Show Checkboxes. Like this:

Now I know you're wondering…"What do these checkboxes actually do?" Allow me to explain.

These checkboxes that you are given the opportunity to show provide the ability to select multiple unit tests at a time, regardless of whether or not they are within the same node. (A node represents a test assembly, a class within an assembly, or a single test within a class.)

The default user interface allows you to select only one node at a time. All tests within that node are run.

The "Show Checkboxes" mode allows you to, not only show the checkboxes, but to use them to select multiple individual tests or nodes. This is very useful when you have a large number of tests and only need to run a select few.

For the sake of full disclosure, this feature is a bit buggy. If you show the checkboxes, use them to select some tests, then go back to the default mode, the checkboxes will still be checked, they just won't be shown. In other words, the tests will still be selected and only those tests will get run. Maybe that's why it's called "Show Checkboxes" – the multi-select feature is still in use, you just can no longer see it unless you show them.

Even worse, if you then go back to "Show Checkboxes" mode, the previously-selected tests will not appear to be checked, but NUnit only runs those tests as if they were still selected. Once you're in this state, you might just want to close and reopen NUnit, because it gets very confused about what's checked and what's not.

For the love of humanity, please, just show the checkboxes and leave them shown! Despite the bugs, I find this feature very useful.

 

(The version of nUnit referenced in this blog post is 2.4.3)

Visual Studio debugger quits debugging ASP.NET page after 90 seconds

I recently upgraded to Vista and am now developing ASP.NET pages running on IIS 7. One frustrating change I noticed is that every time I'm stepping through code-behind, the debugger stops after about 90 seconds and detaches from the process. This doesn't give me much time to drill down the endless hierarchy in my Locals window! (How many times can you click plus signs next to "base" object nodes? Separate issue.)

I thought maybe I could just train myself to click faster, but failed. I tried and tried, but just couldn't click fast enough. Instead, I was forced to figure out the issue. It turns out, IIS 7 pings the worker process at regular intervals to determine if it's still attached. The default is 90 seconds. I'm not exactly sure why this would force the process to detach, but, at least for me, mysteriously, it does.

Here's how you turn off that brutal pinging, or extend the brutal pinging interval:

1) Open IIS Manager

This is IIS Manager. It is very wide.

 

2) Click the "View Application Pools" link on the right.

 

3) Select your application pool and click the "Advanced Settings…" link.

 

4) Either a) set the "Ping Enabled" property to False, or b) set the "Ping Maximum Response Time (seconds)" to a large number.

 

There you go. Now you'll have more than 90 seconds to find that bug!

Getting a labeled set of files from Team System

One of the great things about developing business software is that no matter how many features you build into an application, you can always think up more. In the project I'm on, we release new features to the client about once a month. This is fun! The client continually gets to request new features, and according to priority, we get to build them. It does, however, require frequent deployment, and it's important to take a snapshot of the source code each time you deploy in case a patch is required.

Team System allows you to take a snapshot of a set of files by applying a "label." This snapshot can then be retrieved at a later date, modified, and re-deployed if necessary. To apply a label to a set of files:

  • Open Source Control Explorer.
  • Browse to the folder containing the files, right click, and choose Apply Label.
  • With "All files (*.*)" selected in the Items of type dropdown, all of the files in the source control folder will be included in the snapshot. (In my version, this is the only option.)

Creating the labeled set is pretty straightforward, but I've found retrieving the set to be a bit buggy if not done a certain way. I had never encountered any problems until switching to Windows Vista.

One error I've encountered when getting a labeled set is "Some:\FilePath\ToSomeFile.cs: Cannot create a file when that file already exists."

[The following section was edited on 8/23/2007]

This issue seems to be a bug in the Visual Studio IDE. When you have the solution open and attempt to get a specific version, sometimes one or more (seemingly random) files can't be written to disk for some reason. It does, however, delete the culprit file from your file system. If you were forcing the get, you'll get the error message above. Otherwise, VS will quietly delete the file without telling you.

Even worse, once the file is deleted from your file system, Team System still thinks you have it, so future attempts to get the file will not fetch it. Without forcing the retrieval of the specific missing file, your solution is hosed.

I've found the following steps work when retrieving a labeled set of files.

  1. Close your solution
  2. Open Source Control Explorer (aka Team Explorer) and browse to the root of the labeled location.
  3. In the Version-->Type dropdown, select "Label."
  4. You'll probably need to find the label, so
    • Click the "..." button.
    • In the Find Label dialog, click "Find" after entering the appropriate search criteria.
    • Select the appropriate label from the Results list.
    • Click "Close." (I think "OK" would have been more intuitive.)
  5. To make sure I get everything, I check the "Overwrite writeable files that are not checked out" and "Force get of file versions already in workspace" checkboxes.
  6. Click "Get."

Visual Studio will now show a progress bar while it retrieves the files. When finished, you will have the snapshot source code on your local file system.

[/end edited section]

 

Don’t be fooled by the JIT debugger error message.
(Reposted due to unbearable number of spam comments.)

The other day I came across the following weird error after changing one line of code in an ASP.NET 2.0 web app:

"JIT Debugging failed with the following error: Access is denied."

So I did what the message said to do… I checked the documentation for "Just-in-time debugging, errors," specifically an error that mentions "Access is denied." Not surprisingly, the docs kindly informed me that the user account the app ran under did not have permission to access the JIT Debugger.

Hmm. Just like the error message says, right?

I found this a bit fishy. I was able to access and debug other pages in the web app. I tried stepping through my code and found that the source of the problem was an infinite recursion which caused a stack overflow exception. For some reason VS2005 wasn't able to report this error.

Sample WPF/e sites

In case you didn't know, WPF/e is hot… it's HOT! At least it's supposed to be sometime soon. However, before attending VSLive! this week, I was wondering, has anyone actually tried using it? I had seen the British Library's "Turn the Pages" app a while back (which is really cool!), and a colleague of mine (James) presented to the company a sample application he built. Other than that, I hadn't seen much WPF/e in action.

At VSLive! I got to see some cool WPF/e samples. This inspired me to dig around for some more. Those of you already curious about WPF/e may have already seen some of these, but for those who haven't, have a look and imagine the capabilities.

  1. Here's a really cool Vista simulation. Imagine trying to do this with HTML tags. (Or not.)
  2. As I mentioned, the British Library's "Turn the Pages" app is very cool. Unlike the other examples I mention, this one is a XAML Browser Application (XBAP), and requires installation of the .NET Framework 3.0.
  3. A colleague of mine (Alan) informed us of the Page Turn sample a while back.
  4. Here's a cool WPF/e video player, also thanks to Alan.
  5. The WPF/E flickr Photo Viewer is not bad. I typed in "vacation" and it scrolled pretty pictures.
  6. The rest of the samples below are in the February 2007 CTP Sample Pack download.

Grand piano. Use keyboard keys Z, X, C, V, etc. for white keys and the next row up for black keys. This was all done with WPF/e controls, such as rectangles, etc. i.e., nothing was "painted."

 

Sprawl game. Much like the Shockwave games we've come to appreciate:

 

Sleek video player. WPF/e comes with a built-in media player (not reliant on Windows Media Player or QuickTime). This is an improvement to the default one that comes with WPF/e, and has a full screen mode:

 

The other samples in the CTP each demonstrate a few key concepts at a time, and are also worth taking a look at.

To run a page using WPF/e, you'll need a compatible browser (IE 6 or 7, Firefox 1.5 or 2) and operating system (Apple Mac OS X, Windows Vista, Windows XP SP2), and you need to install WPF/e. However, in true Macromedia-Flash-like fashion, all you need to do is browse to a page that uses WPF/e and you'll get a link to download the required version.

 

WPFE

 

 ‭(Hidden)‬ Admin Links