Hi Matthew,

Thanks for your reply. Well, since you have asked, I need to go into
details. I am trying to use the Microsoft POS (Point-of-Service) for .NET
SDK. If you are not familiar, this is an API that makes development of a
Point-Of-Sale application a breeze in the park. You have classes to control
and command receipt printers, cash drawers, bar-code readers, magnetic strip
card reader and what not. There is only a version for .NET 1.1 that's been
released so far. I have created some samples in VS 2003 that are working w/o
problems. It's just a simple console application that prints "Hello World!"
on the receipt printer. If I take that very simple piece of code and put it
into a VS 2005 C# stand-alone console application project, the code compiles
fine but fires up the said exception when executed. It does so when a call
into the (>NET 1.1) POS API is made. That's why it got me thinking that
something may be wrong with mixing the .NET 1.1 assemblies in to a .NET 2.0
project. I keep reading that .NET 2.0 is backwards compatible, so it should
work.
You are asking what type of exception is thrown and which line is doing it.
Here is a snippet from my code:

// <snip>
string strLogicalName = "PosPrinter";

try
{
   // Create PosExplorer
   PosExplorer posExplorer = new PosExplorer();

   DeviceInfo deviceInfo = null;

   try
   {
      deviceInfo =
posExplorer.GetDevice(DeviceType.PosPrinter,strLogicalName);
      PosPrinter posPrinter
=(PosPrinter)posExplorer.CreateInstance(deviceInfo);

// intialization

      // Step 1: Open the device
        posPrinter.Open();

      // Step 2: Claim the device
        // Get the exclusive control right for the opened device.
        // Then the device is disable from other application.
        posPrinter.Claim(1000);

      // Step 3: Enable the device
        posPrinter.DeviceEnabled = true;

      // print a message
      posPrinter.PrintNormal( PrinterStation.Receipt, "Hello World!\n" );

// releasing the printer

      // Step 1: Cancel the device
        posPrinter.DeviceEnabled = false;

        // Step 2: Release the device exclusive control right.
        posPrinter.Release();

      // Step 3: Close the device
      posPrinter.Close();
   }
   catch( PosControlException exError )
   {
      Console.WriteLine( exError.Message );
   }
}
catch( PosControlException exError )
{
   Console.WriteLine( exError.Message );
}

// <snip>

PosExplorer is a class that implements some sort of super-manager of all POS
things. It detects what POS devices you have in the system and after that
you can instantiate a specific type of device if you know the logic name.
And yes, even in VS 2005, posPrinter is instantiated to a PosPrinter object.

Above steps 1, 2 & 3 are required for both init and release processes. In
between is where you print your stuff. My exception is thrown by step 1 of
the initialization process: "posPrinter.Open();", and like I said in my
original message, the error says that "The information is not described in
XML", which makes me think that is nothing wrong with my code (it is working
under VS 2003) but rather with how the calls are made between the two
frameworks.
Ok, I went for too long. I hope you get the overall picture.

Regards,
Eddie


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Matthew Wills
Sent: Wednesday, May 17, 2006 9:45 PM
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] .NET 1.1 .dll referenced in a .NET 2.0


Eddie,

>> I get some rather weird exceptions (the message is "The information is
not described in XML").

Is that exception when you compile the app? Or when you run it? Are you
sure it is an exception and not a warning?

Also, what is the exception type? Also, show us the line where the above
exception is being thrown.

Thanks
Matthew Wills @ MLC
Senior Analyst Programmer

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to