Sunday, November 30, 2008

Client Application Services Bug?

I recently started playing around with .NET 3.5 Client Application Services, and by chance ran across this weird bug:

If you use the namespace: ClientAppServicesTest in your win forms client application, it appears that you will be unable to call any of the authentication web services. It's one of those things that I still don't really believe, and I probably am doing something else weird, but right now I seem to have narrowed it down to that specific namespace. If I change the namespace to ClientApplServicesTest (note the 'Appl'), the web service calls get made.

In case anyone else is experiencing this I decided to create my first blog post on this issue.

For instance, the following code will invoke Form1 which will fail to call the web services:


using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace ClientAppServicesTest
{
static class Program
{
///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ClientAppServicesTest.Form1());
}
}
}


Note that Program and Form1 are both in the ClientAppServicesTest namespace

Whereas the following code will invoke Form1 which will successfully call the web services:


using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace ClientAppServicesTestFoo
{
static class Program
{
///


/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ClientAppServicesTest.Form1());
}
}
}

Note that Form1 is still in the ClientAppServicesTest namespace and Program is now in the ClientAppServicesTestFoo namespace

the form_load handler in Form1 just makes a call to:

!Membership.ValidateUser("employee", "employee!")

This example is pretty much as per the MSDN walkthrough on using Client Application Services:

http://msdn.microsoft.com/en-us/library/bb546195.aspx



No comments: