Errors
Fun errors and their solutions.
The Parallel port driver service failed to start – Hyper-V

imageI migrated Bit Armory's servers from Virtual Server 2005 R2 to Microsoft Windows 2008 R2 Hyper-V and ran into a lot of friction.

Anyway, the migrated servers had annoying errors from the Service Control Manager saying:

Event Type:    Error
Event Source:    Service Control Manager
Event Category:    None
Event ID:    7000
Description:
The Parallel port driver service failed to start due to the following error:
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

image

The problem can easily be solved by disabling the "Parvdm" device & driver service.  Open Device Manager, Check "Show hidden devices", find "Parvdm" in "Non-Plug and Play Drivers".

image image

Then all should be well. Again, just more friction from Microsoft.  They really need to test this stuff. confused0072.gif

Hope that helps,
Brian Chavez

6 Comments Filed Under [ Errors ]
ScriptSharp and 'not using an unsupported feature'

image Well, I was working on killing a bug in JavaScript and I needed Sys.Debug.trace() to help.  I used Script#, and the compiler yelped this error at me:

Check that your C# source compiles and that you are not using an unsupported feature.

Whoops.  Didn't find much around and on good ole' Google, so I didn't have much of an option.  Turns out, I was using namespace-qualified types like so:

   Sys.Debug.Trace( "foo" );

Just change your code to:

    Debug.Trace( "foo" );

And the compiler should be happy again.

Script# is a great tool to add to your tool belt along with MS AJAX and jQuery.  The Script# suite isn't exactly full-feature-tested compiler yet, but it's getting there!  Thanks again Nikhil Kothari!

Hope that helps!

Brian Chavez

Add Comment Filed Under [ Errors ]
NAnt 0.86, script task with RegEx and RegularExpressions

image Muah.  While updating to NAnt 0.86, I was stuck with the following error while trying to execute a <script> task:

The name 'Regex' does not exist in the current context

I was using a <script> task to do some RegEx some files apart of the build process.  Well, turns out that NAnt 0.86-beta2 has a breaking changeSystem.Text.RegularExpressions is now removed by default from the imported assemblies of <script> tasks.  Oh well...

The following should get you back on track:

  641     <script language="C#">

  642           <code>

  643 <![CDATA[

  644         //C# code goes here...

  645   ]]>

  646           </code>

  647         <imports>

  648             <import namespace="System.Text.RegularExpressions"/>

  649         </imports>

  650         <references>

  651             <include name="System.dll"/>

  652         </references>

  653     </script>

Just add the <imports> and <references> section to the <script> task and all should be well again! :)

Brian Chavez

One Comment Filed Under [ Errors ]
Upgrading SubText, IIS7, Windows 2008

image Bit Armory, Inc. has decided to finally make the move to IIS7 for production.  Let's hope it goes well.

 

First Impressions:

  • Performance seems a little better
  • Better ASP.NET MVC support
  • Easier Setup

I did have a problem with Subtext and IIS 7 yelping back an error:

"System.Web.HttpException: Request is not available in this context"

Thanks to Lance Fisher, the fix was easy, simply set "Classic .NET AppPool" in Manage Web Site > Advanced Settings ... should do the trick.

image

 

Hope that helps!

Brian Chavez

Add Comment Filed Under [ Tips & Tricks Errors ]
Whoa! Google Chrome has crashed

ALL my chrome browser windows just now closed...  I thought Google Chrome was immune to crashes.... apparently not.  Guess that "process isolation" feature stuff was pure marketing... fighting0016.gif

image

4 Comments Filed Under [ Errors ]
BadImageFormatException Errors

I've been playing with Lua Programming/Script Language and LuaInterface, because I have a need for embedding a scripting language in one of our projects.  Unfortunately, when trying to run one of the test case applications that came with LuaInterface, I was presented with a nice error shown below:

image

Anytime, you run a .NET application, the operating system reads the PE header information of the executable to help setup the process environment.  In my case, TestLua.exe was being setup and ran in x64 mode with an x64 runtime and failed to P/Invoke Lua's native 32-bit DLL.

Solution

In general, there are two main ways we can explicitly tell the operating system to load and use 32-bit process environments:

For applications and assemblies that you can not recompile:

  • Set the 32-Bit flag in the PE header. 

    For example, since the 32-bit flag in TestLua.exe was not set, I forced 32-bit mode by setting the 32-bit flag using CorFlags.exe:

    Start "Visual Studio SDK Command Prompt" and execute:
    CorFlags.exe /32bit+ TestLua.exe

For applications and assemblies that you can recompile:

  • Recompile using the "Target Platform" settings as illustrated here.

In practice, if you do low-level COM, P/Invoke, Win32 stuff, you'll probably need to set these 32-bit flags for your applications; however, if your application purely lives in the managed world, you won't need to do anything!

Add Comment Filed Under [ Tips & Tricks Errors ]
Vista Explorer Annoyances and Enhancements

image You might think this is a post about add-ons to Vista's Windows Explorer, but actually, it's a post about how to remove features in Vista's Explorer to make it actually usable and tolerable to work with.

Enhancement #1

Vista Explorer has the most annoying ability to "sniff folders" and try and guess what the file types are in your folder.  If .png, .jpg, or other image related file types exist in your folder, Explorer will switch to a "thumbnail/Large Icon" view, even though you've explicitly set a view to "apply to all" folders.  Here's how to get rid of the annoying behavior.

http://www.vistax64.com/tutorials/70819-windows-explorer-folder-view-settings.html

Enhancement #2

Vista Explorer forgets size & location.  Make Vista Explorer remember the size of the explorer window.

http://jtbworld.blogspot.com/2007/04/remember-vista-windows-explorer-window.html 

Enhancement #3

Segoe UI is the most annoying font in the world.  Change it here:

http://steve.fsxtreme.com/blogs/2008/01/16/say-no-to-segoe-and-cleartype-on-vista/

Seriously, the Windows Shell Team did a terrible job with Vista and they all need a few basic lessons on usability...

fighting0016.gif

Add Comment Filed Under [ Tips & Tricks Errors ]
NHibernate - null id in entry (don't flush the Session after an exception occurs)

imageI ran into this issue today when trying to persist one of my objects.  The cause of the problem was interesting.  I was trying to save an object when a property/columns in the table had a unique constraint.  As a result, the object that I was trying to persist would not persist simply because the object's property it failed to meet the unique constraint.

As a result, a call to Save() on the object failed and the ID on the object I was trying to save was not set, but NHibernate still processed the object and associated it with its persistence mechanism leaving it in a "semi-persistent" state with the NHibernate persistence manager (ie: NHibernate now knows about the object you tried to save and it SHOULD have fully evicted the object from its persistence manager because the save failed, but it didn't).

When an HTTP request finishes on my ASP.NET application, I flush and close all NHibernate session objects at the time the request is done.  And as a result, when the HTTP request finished, NHibernate attempted to flush the jacked up "semi-persistent" object (an object who's ID was null) and ultimately generating the error above.

So, the solution that I implemented was to wrap the Save() in a try{} catch{} statement, and if the save failed, immediately close and shutdown the session, handle the error/exception.  Then, check if Session.IsOpen when the HTTP request finishes.

Hope that helps, confused0081.gif

Brian Chavez

WMI Provider Error - Access Denied - TDSSNIClient initialization failed with error 0x5

imageI got an interesting error while trying to change the log on service account for SQL server.  I got a "WMI Provider Error" and a bunch of errors in the Windows Event Log.

Simple solution:

Restart.

The problem is simply, a Named Pipe issue.  Restarting re-creates the Named Pipe under the correct log on account.

 

 

 

 

If the restart fails, and you're still having problems connecting to SQL Server Remotely, try the following:

  • Set the log on account permissions on:

    C:\Program Files\Microsoft SQL Server
    C:\DATA DIRECTORY

    for the log on account.  You'll need to set "Full Control" permissions and make sure that you re-apply the rule to all children by clicking on the directory properties>Security>Advanced>Permissions>"Replace permission entries on all child objects..."

Hope that helps.

AJAX and ASP.NET Template Controls

I was programming today (err. early morning, 1:00 AM) and stumbled across this error:

[NullReferenceException: Object reference not set to an instance of an object.]

   AjaxControlToolkit.ExtenderControlBase.LoadClientStateValues() in d:\E\AjaxTk-AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:332

   AjaxControlToolkit.ExtenderControlBase.Page_PreLoad(Object sender, EventArgs e) in d:\E\AjaxTk-AjaxControlToolkit\Release\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:287

   System.EventHandler.Invoke(Object sender, EventArgs e) +0

   System.Web.UI.Page.OnPreLoad(EventArgs e) +86

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +948

AJAX apparently blew chunks.  After taking a look at the AJAX source code ExtenderControlBase.cs (thank goodness it's open source), the LoadClientStateValues() was trying to load some hidden client state data stored in a hidden control being resolved by FindControl() method on NamingContainer.  Well, because I was using my AJAX control in a LayoutTemplate, NamingContainer tuned out to be null which was causing ASP.NET's OnPagePreload -> LoadClientStateValues() to fail.

Here was the offending code:

<asp:Login ID="Login2" runat="server" OnLoginError="Login2_LoginError">

    <LayoutTemplate>

            <fieldset>

                <div class="panel-username">

                    <p>

                        <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" CssClass="labeltext bold">Email Address:</asp:Label>

                        <asp:TextBox ID="UserName" runat="server" CssClass="textbox"></asp:TextBox>

                        <ajax:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="UserName"

                            WatermarkText="Enter Email Address" WatermarkCssClass="watermark">

                        </ajax:TextBoxWatermarkExtender>

                        <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"

                            ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl00$Login2">*</asp:RequiredFieldValidator>

                    </p>

                </div>

                <div class="panel-password">

                    <p>

                        <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" CssClass="labeltext bold">Password:</asp:Label>

                        <asp:TextBox ID="Password" runat="server" TextMode="Password" CssClass="textbox"></asp:TextBox>

                        <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"

                            ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl00$Login2">*</asp:RequiredFieldValidator>

                    </p>

                </div>

                <div style="float: left; width: 150px;">

                    <p>

                        <span class="bold">Don't have an account?</span> <a id="A1" href="~/common/SignUp.aspx"

                            runat="server">Register here</a>. It's easy and free!</p>

                </div>

                <div class="panel-button">

                    <p>

                        <asp:ImageButton ID="LoginButton" runat="server" CommandName="Login" ValidationGroup="ctl00$Login2"

                            ImageUrl="~/Images/TransparentPixel.gif" CssClass="cmdSignIn" />

                    </p>

                    <p style="padding-top: 10px;">

                        <a href="#">Forgot password?</a></p>

                </div>

            </fieldset>

    </LayoutTemplate>

</asp:Login>

As you can see, the offending line of code is marked in bold above.  I was using the TextBoxWatermarkExtender on the UserName TextBox control.  Since AJAX needs a NamingContainer, a simple work around is to simply wrap the code in a ASP.NET Panel control, and you're problems will go away like so:

<asp:Login ID="Login2" runat="server" OnLoginError="Login2_LoginError">

                    <LayoutTemplate>

                        <asp:Panel ID="panWrapper" runat="server">

                            <fieldset>

                                <div class="panel-username">

                                    <p>

                                        <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" CssClass="labeltext bold">Email Address:</asp:Label>

                                        <asp:TextBox ID="UserName" runat="server" CssClass="textbox"></asp:TextBox>

                                        <ajax:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="UserName"

                                            WatermarkText="Enter Email Address" WatermarkCssClass="watermark">

                                        </ajax:TextBoxWatermarkExtender>

                                        <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"

                                            ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl00$Login2">*</asp:RequiredFieldValidator>

                                    </p>

                                </div>

                                <div class="panel-password">

                                    <p>

                                        <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" CssClass="labeltext bold">Password:</asp:Label>

                                        <asp:TextBox ID="Password" runat="server" TextMode="Password" CssClass="textbox"></asp:TextBox>

                                        <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"

                                            ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl00$Login2">*</asp:RequiredFieldValidator>

                                    </p>

                                </div>

                                <div style="float: left; width: 150px;">

                                    <p>

                                        <span class="bold">Don't have an account?</span> <a id="A1" href="~/common/SignUp.aspx"

                                            runat="server">Register here</a>. It's easy and free!</p>

                                </div>

                                <div class="panel-button">

                                    <p>

                                        <asp:ImageButton ID="LoginButton" runat="server" CommandName="Login" ValidationGroup="ctl00$Login2"

                                            ImageUrl="~/Images/TransparentPixel.gif" CssClass="cmdSignIn" />

                                    </p>

                                    <p style="padding-top: 10px;">

                                        <a href="#">Forgot password?</a></p>

                                </div>

                            </fieldset>

                        </asp:Panel>

                    </LayoutTemplate>

                </asp:Login>

Now it works :)  Hope that helped anyone running into the same problem.  Whenever you're dealing with ASP.NET template controls, and you're using AJAX within these template controls, be sure to wrap the control pointed to by TargetControlId & the AJAX control itself in it's own naming container to avoid issues like this.  Another bug down fighting0028.gif. :)

2 Comments Filed Under [ Tips & Tricks Errors ]