473,803 Members | 3,073 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problems converting C# code to VB.net (MSMQ formatter problem)

I have a piece of code that works in C# but when I convert it to VB.Net I get
the following error: "Cannot deserialize the message passed as an argument.
Cannot recognize the serialization format."

C# Code
-----------
System.Messagin g.MessageQueue myInputQueue = new
System.Messagin g.MessageQueue( @".\Private$\In putQueue");
((XmlMessageFor matter)myInputQ ueue.Formatter) .TargetTypes = new
Type[]{typeof(Order)} ;

Order test1 = new Order();
test1.intID = "123";
System.Messagin g.Message m1 = new System.Messagin g.Message(test1 );
myInputQueue.Se nd(m1);

System.Messagin g.Message m2 = myInputQueue.Re ceive();
Order test2 = (Order)m2.Body;
MessageBox.Show (test2.SSN);

VB.Net Code
--------------
Dim myMessageQueue As MessageQueue = New MessageQueue(g_ strInputQueue)
CType(myMessage Queue.Formatter , XmlMessageForma tter).TargetTyp es = (New
Type() {GetType(Order( ))})

Dim myOrder As Order = New Order
myOrder.intID = "123"
Dim myMessage As Message = New Message(myOrder )
myMessageQueue. Send(myMessage)

Dim myNewMessage As Message = myMessageQueue. Receive
Dim myNewOrder As Order = CType(myNewMess age.Body, Order)

Does anyone have any ideas?
Sep 12 '05 #1
1 4442
Nevermind...I got it working.

"CLEAR-RCIC" wrote:
I have a piece of code that works in C# but when I convert it to VB.Net I get
the following error: "Cannot deserialize the message passed as an argument.
Cannot recognize the serialization format."

C# Code
-----------
System.Messagin g.MessageQueue myInputQueue = new
System.Messagin g.MessageQueue( @".\Private$\In putQueue");
((XmlMessageFor matter)myInputQ ueue.Formatter) .TargetTypes = new
Type[]{typeof(Order)} ;

Order test1 = new Order();
test1.intID = "123";
System.Messagin g.Message m1 = new System.Messagin g.Message(test1 );
myInputQueue.Se nd(m1);

System.Messagin g.Message m2 = myInputQueue.Re ceive();
Order test2 = (Order)m2.Body;
MessageBox.Show (test2.SSN);

VB.Net Code
--------------
Dim myMessageQueue As MessageQueue = New MessageQueue(g_ strInputQueue)
CType(myMessage Queue.Formatter , XmlMessageForma tter).TargetTyp es = (New
Type() {GetType(Order( ))})

Dim myOrder As Order = New Order
myOrder.intID = "123"
Dim myMessage As Message = New Message(myOrder )
myMessageQueue. Send(myMessage)

Dim myNewMessage As Message = myMessageQueue. Receive
Dim myNewOrder As Order = CType(myNewMess age.Body, Order)

Does anyone have any ideas?

Sep 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8002
by: Pete Loveall | last post by:
I have a server application that monitors a private local queue for messages. The message sent to it has a label and a response queue defined. It works correctly when the queue is accessed via another program. However, when I attempt to Send a message from an ASP.NET VB page, I get "One or more of the passed properties are invalid." I have tried different combinations of the non-transactional Send() with no success. My Windows\Temp...
0
4075
by: Kimmo Laine | last post by:
Hi, how can i be sure that the MSMQ Message.Body property contains something valid? If i send the message like this: public void SendMyMessage( int msgCode, object msgData ) { Message msg = new Message(); msg.AppSpecific = msgCode; msg.Body = msgData;
3
4365
by: Stephan Schlicker | last post by:
Hi everyone I have a serious problem with the serilization of an user-defined object in C#. I would like to serialize an object of class D which inherits from class C. Class C as well as class D are marked with the compiler-attribute (see also code-snippet at the end of the message). It is no problem to serialize a instance of class C, but I got the following error-message if I try to serialize a instance of class D: An unhandled...
1
2693
by: Jim S | last post by:
I have an application where I have to make a tree of objects. To do this, I have my own node class. At certain points in the application, I need to save data. I am having a problem with the SoapFormatter. The following program gets the exception: "The data at the root level is invalid. Line 55, position -460." This code works fine if I use a BinaryFormatter instead of a SoapFormatter. Any ideas? Here is a test program:
2
2429
by: alexandre martins | last post by:
Every time i try to make Deserialize the computer gives me the folowing error: "End of Stream encountered before parsing was complete" the code that i'm running is simple and is based on an MSDN example. The CODE is BELOW this lines. If you see something wrong or missing please answer. Class declaration:
1
310
by: CLEAR-RCIC | last post by:
I have a piece of code that works in C# but when I convert it to VB.Net I get the following error: "Cannot deserialize the message passed as an argument. Cannot recognize the serialization format." C# Code ----------- System.Messaging.MessageQueue myInputQueue = new System.Messaging.MessageQueue(@".\Private$\InputQueue"); ((XmlMessageFormatter)myInputQueue.Formatter).TargetTypes = new Type{typeof(Order)};
1
1367
by: parez | last post by:
I am trying to use msmq to send messages(serialised object) from a .net 1.1 webapp to .net 2.0 windows service. Is it possible? If yes then will the binary formatter work ?
4
6278
by: IdleBrain | last post by:
I wrote an application that puts in a message into MSMQ using C++ and MFC. If I try to put a message called 'sample' I see that the body of the message in MSMQ would be set to: 's.a.m.p.l.e'. On the other hand I have a C# application that reads the same message queue and it expects the body format to be: '<?xml version="1.0"? >..<string>sample</string>'
2
12160
by: Chizl | last post by:
On the MQReceiveCompleted method below, I get an error "Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 40.".. This data is XML that I'm putting into this queue. --------- <?xml version=""1.0"" encoding=""utf-8""?><DATA><FIELD1>CHIZL</FIELD1><FIELD2>DA MAN</FIELD2></DATA> --------- Methods
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10300
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9127
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7607
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2974
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.