I am using ProtoBuf-Net in my .NET application to serialize the
following : (in .proto format)
message ProtoScreenBuffer {
optional int32 MediaId = 1;
optional bytes Data = 2;
optional bool LastBuffer = 3;
optional int64 StartTime = 4;
optional int64 StopTime = 5;
optional int32 Flags = 6;
optional int32 BufferSubType = 7;
optional int32 BufferType = 8;
repeated int32 EncryptedDataStart = 9;
repeated int32 EncryptedDataLength = 10;
}
I serialize this into a byte array, using protobuf-net,
and pass it to the C++ app.
What goes out of the .NET and what comes into the C++ app is 100%
identical.
It then should be deserialized in the C++ app.
I try to do :
m_screenBuffer.ParseFromArray(serBuffer, dwInputDataLen);
(where m_screenBuffer is ProtoScreenBuffer object, serBuffer is the
raw byte array I got from the .NET app, and dwInputDataLen is the
length of it.)
The problem is, I get a memory access violation when I try to
deserialize it :(
Unhandled exception at 0x02f166d8 in wmplayer.exe: 0xC0000005: Access
violation writing location 0x00000000.
Are any of the things I'm doing here wrong , for what I'm trying to do
(serialize in C# .NET and deserialize in C++?)
Thanks alot.
Roey
I believe this means you are accessing a NULL pointer somewhere. You
should attach a debugger to your process and look at the stack trace
to figure out where this is happening. My unhelpful guess is that
something is not initialized correctly. Good luck,
Evan
--
Evan Jones
http://evanjones.ca/
[snip]
> The problem is, I get a memory access violation when I try to
> deserialize it :(
> Unhandled exception at 0x02f166d8 in wmplayer.exe: 0xC0000005: Access
> violation writing location 0x00000000.
>
> Are any of the things I'm doing here wrong , for what I'm trying to do
> (serialize in C# .NET and deserialize in C++?)
Most likely yes, but it's hard to suggest what that is without a brief
code example that shows the crash. The crash is obviously trying to
write into a null pointer, but only you can find out what code is at
address 0x02f166d8.
Michael Poole
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
The crash occurs in my auto-generated cc file for the google proto
structs , on this line :
// optional bytes Data = 2;
case 2: {
if
(::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED)
{
parse_Data:
DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( <-----------------------
crash occurs here
input, this->mutable_data()));
I do not know what this macro/code is trying to do (I guess it's
trying to deserialize my data field)
// optional bytes Data = 2;
case 2: {
if
(::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED)
{
parse_Data:
DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( <--------------
This crashes
input, this->mutable_data()));
Hi Kenton, thanks for the reply.DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(input, this->mutable_data()));
this line causes the access violation :I checked this in the debugger. This-> , is not null, and is the message object itself.Input is a CodedInputStream type, and it is not null either.I haven't the code for ReadBytes, I don't know what goes on inside it, but I can tell you that the "input_" field of the CodedInputStream, is null. (the "buffer_" field is not null ).since I can't delve into ReadBytes, I have no idea what's causing the access violation....
Thanks for all the help.
Roey
> >> On Thu, Mar 11, 2010 at 5:56 AM, Roey <roey...@gmail.com> wrote:
>
> >>> Just to clarify , the access violation occurs inside the
> >>> ParseFromArray function, right when it tries to parse the second field
> >>> of the struct ("data"),
> >>> this is the code that crashes inside the cc file :
>
> >>> // optional bytes Data = 2;
> >>> case 2: {
> >>> if
> >>> (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
>
> >>> ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED)
> >>> {
> >>> parse_Data:
>
> >>> DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
> >>> <--------------
> >>> This crashes
> >>> input, this->mutable_data()));
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Protocol Buffers" group.
> >>> To post to this group, send email to prot...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> protobuf+u...@googlegroups.com<protobuf%2Bunsubscribe@googlegroups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/protobuf?hl=en.- Hide quoted text -
>
> - Show quoted text -
We've got some VS2008 versions we can contribute; we deliberately
created them in parallel to to the existing vs/ directory.
-austin
--
Austin Ziegler • halos...@gmail.com • aus...@halostatue.ca
http://www.halostatue.ca/ • http://twitter.com/halostatue
Do you have 2005 and 2008 on a single system, or are they on
independent systems? If they're on the same system, VS does not always
offer to upgrade, but opens the VS projects in the same VS that they
were created in. You have to explicitly force them to upgrade.
I agree that if you can avoid it, you shouldn't maintain two different
sets of vsproj files, but if all you're doing is downconverting a
vs2008 vsproj to vs2005, then it couldn't hurt to ship both in the
tarball, even in separate directories.
On Tue, Mar 16, 2010 at 3:24 PM, Kenton Varda <ken...@google.com> wrote:Do you have 2005 and 2008 on a single system, or are they on
> I do test each release with both VS2005 and VS2008, and haven't seen that
> problem before. Odd.
independent systems? If they're on the same system, VS does not always
offer to upgrade, but opens the VS projects in the same VS that they
were created in. You have to explicitly force them to upgrade.
I agree that if you can avoid it, you shouldn't maintain two different
sets of vsproj files, but if all you're doing is downconverting a
vs2008 vsproj to vs2005, then it couldn't hurt to ship both in the
tarball, even in separate directories.
Except in the case where the user has both VS2005 and VS2008 installed
on the same system. As many of the developers at my place of work do.
If you give me VS2005 projects and I have both VS2005 and VS2008
installed, I have to explicitly open the VS2005 projects with VS2008
to make them work. This also may not work in scenarios where someone
may need to provide compiled versions that work with VS2005 and VS2008
(separately built versions). It's able to be worked around (we copied
the VS2005 projects to a new directory and forced them to be opened
with VS2008), but it is a little annoying.
on the same system.Except in the case where the user has both VS2005 and VS2008 installed
Common enough that I think it's worth doing something about it. We're
going to be facing the VS2010 problem by the end of the year, in
house.