Decoding SharePoint error messages

I had just activated a new feature on a WSS 3.0 site, and attempted to add one of its Web Parts to a page, when up came a helpful error message:

“The Web Part you attempted to add no longer exists in the Closed Web Parts Gallery.  Refresh your browser to update the Web Part Page and the Gallery.”

But the problem is that I attempted to add an Ajax web part to a page without first installing ASP.NET Ajax.  Daniel Larson said it best: “This is the WORST error handling ever.” This error message offers almost no help.  Daniel Larson’s blog post on the other hand, was a big help (many thanks)!

 

image

 

This brings to mind another infamous SharePoint error message that appears after modifying any aspect of a “ghosted” page with SharePoint Designer, which moves the page to an “unghosted” state (i.e., the page is moved from disk into the content database) and causes the page to be executed in Safe Mode.  If any inline scripts are in the page, you might see this friendly reminder:

“An error occurred during the processing of /SomeDir/SomePage.aspx. Code blocks are not allowed in this file.”

This message makes sense after you’ve seen it a few times, but isn’t very helpful if you’re new to WSS, and making even a trivial change breaks your page.  Modifying web.config to always allow server scripts to run is a quick and dirty fix for this one:

<PageParserPath VirtualPath=”/*” CompilationMode=”Always” AllowServerSideScript=”true” IncludeSubFolders=”true” />

But a better (more secure) approach would be to create a custom server-side control, and explicitly register it as safe in web.config :

<SafeControl Assembly=”MyApp, …” Namespace=”MyApp.Controls” TypeName=”*” AllowRemoteDesigner=”True” />

I suspect Microsoft is letting developers write their own error messages, which might explain why they read like code.  As long as people keep blogging their solutions though, I’m happy.

.NET Framework 3.0 Training Stuff

Microsoft will often provide some sort of free training for major rollouts.  They are kindly offering 3 2-hour e-learning clinics to help us get ramped up quickly to 3.0.  I just completed the WPF course, which was a pretty good treatment of the fundamentals of WPF.   But there’s nothing like a little hands-on coding to really figure out how things work. 

Here’s the link: https://www.microsoftelearning.com/eLearning/offerDetail.aspx?offerPriceId=109340

There are also various other free courses at Microsoft’s Visual Studio 2005 E-Learning Catalog.  

Now, the really hot item is WPF/E, a XAML based cross-platform runtime that can deliver rich vector graphics, animation, video, runs on any browser and can that can hook in to client-side [java]script also loaded on the page.  It has a small 1mb download size (up to 2mb planned in the final release), and could prove to be Microsoft’s answer to Flash.   Even better is that this technology has evolved as a natural progression of WPF, and does not seem to be a hostile attempt to compete with Flash… even though… it probably is  :)

Also check out the samples at WPF/E.  Warning!  The page turn sample might make you drool a little.

Here are some other WPF sites worth looking into.:

Soft[be]ware

Just before leaving the office today, I got this email from one of our clients:

Subject: “ARGH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!”

Body: <blank>

That was it! Just “ARGH”.  I only hope the “ARGH” wasn’t my fault, because the client who sent this also copied it to several of my esteemed colleagues who I am often trying not to look like an idiot in front of.  So tomorrow, hopefully we can fill in the <blank>… and let the fun begin!

Stevey’s Rant on Agile

.NET 2.0 Connection Strings

 There is a default connection string named LocalSqlServer in machine.config:


<connectionStrings>

<add name=”LocalSqlServer” connectionString=”data source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true” providerName=”System.Data.SqlClient” />

</connectionStrings>

You can override this in the web.config of your local application like so:


<connectionStrings>

<remove name=”LocalSqlServer”/>
<add name=”LocalSqlServer” connectionString=”…” providerName=”System.Data.SqlClient”/>

</ConnectionStrings>

The problem is, when you drag a SqlDataSource onto the designer and click on “Configure Data Source”, your connection string doesn’t show up (probably because of the <remove> element). But if you remove <remove name=”LocalSqlServer”/> from web.config, this error will come up when you go to “Configure Data Source”:
“Following error occurred while getting connection string information from configuration. “The entry ‘LocalSqlServer’ has already been added.”

Solution: name your connection string something other than LocalSqlServer and it will work!

Whew!

I’m the only one in the office now.  The rest of the team is on the way to Andretti Speedway, but I wanted to blog about this before catching up w/ them.  El Capitan pulled me into his office a while ago, along with one of the project managers, closed the door and told me to sit down.  They looked very grim, and I started to get nervous:  “… is everything… OK?” I asked.   “Actually, yes.”  he said.  “I’ve had 5 different people come to me and tell me that you’re doing a great job, and just wanted to let you know.”  He explained how hard it was to keep a straight face, and I laughed and told him how scary he was.   I think he was pleased.  

Be on the lookout for a suspicious developer

I passed DevX in the hall on my way to the men’s room.  He was nervously talking on his cell phone.  Back at my cube a few minutes later, a security guard stuck her head in the front door and yelled <HERLOO!>.   Someone had reported someone lurking around our floor looking suspicious.  

DevA told the guard that I was the only suspicious one around. 

I said: “Eureka! DevX was out in the hall a minute ago looking suspicious.  I bet they’re looking for DevX!”.  DevX later confirmed that he probably was the suspicious one, but we’ll probably never know for sure.  I guess he gave them the slip.

But the way I see it, there is a real problem on our floor.  It is the guy from Cloop Consulting who never flushes the latrine.  I’ll be sitting on the pot sometimes and can hear him leave without flushing (or washing his hands).  Then apparently everyone uses the other latrine, because his healthy yellow swill festers for hours in the other one, until it stinks like you wouldn’t believe. 

 Next time he “forgets” to flush, I’m considering calling security from the safety of my stall.

Think… think… think…

A coworker came up to my cubicle the other day and cleared his throat to get my attention.  To protect his identity I’ll call him DevX.  “Ben, do you have a minute?  I have an emergency.  Do you know how to restore a database backup?”   I came to the conclusion that DevX had messed up a database.  DevX meekly described how that he ran an UPDATE statement without adding a WHERE clause.  We conversed quietly, both knowing that if we could fix this before the others found out, it would save DevX some major embarrassment. 

Later, in DevX’s cube, I stared at the monitor, wondering whether to tell him the last successful backup was made in April.  I finally did tell him and left DevX’s cube.  He just sat there for a while, and I knew he was thinking hard.  DevX had just set all of the billable hours for one of our clients to zero. 

Still later, DevX came skipping around the corner and screeched to a halt at my cube.  “I had copied that column to another column earlier!” he said.  I just need to copy the numbers back to the old column!  

Seriously, I’ve done the same thing myself a couple of times, and now tend to put a query in a transaction if I am running it on a production server. 

 

 

Atlas Setup Issues

During my first attempt at AJAX with Atlas, I just blew a couple of hours trying to figure out why WebMethod calls from a DynamicPopulateExtender  control were returning null.  It turns out there are a whole slew of elements you need to add to web.config to allow Ajax to call your WebMethods.  If not setup correctly, they will simply return null.

 A good idea might be to copy the web.config file from a site generated with the “Atlas” Web Site template in Visual Studio.

Blown Circuit

Apparently a circuit blew after someone turned off some servers in the server room for maintenance.   I went to the bathroom  to wait for the servers to come back online, and heard the toilet flush over in one of the stalls.  

The guy in the stall was the co-founder’s brother, who had turned the servers off.  He came back to a big surprise.  I overheard something about “I was just taking a @#-!…”