Toolkit/DesktopSample Problems

Jul 9, 2007 at 7:59 AM
The DesktopSample does not work on my computer. However, I have tried the sample on another one of my computers and it works fine from there. It just doesn't seem to work on my main computer. I got this message in a Message Box when I tried to run the DesktopSample: "Unable to read data from the transport connection: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.."

Also, I came across this exception when trying to run a simple application that I wrote in C# in Visual Studio 2005:

System.IO.IOException was unhandled
Message="Unable to read data from the transport connection: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.."
Source="System"
StackTrace:
at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadToEnd()
at Facebook.API.FacebookAPI.GetQueryResponse(String requestUrl, String postString)
at Facebook.API.FacebookAPI.ExecuteApiCallString(IDictionary`2 parameterDictionary, Boolean useSession)
at Facebook.API.FacebookAPI.GetUserInfoXml(String userIds)
at Facebook.API.FacebookAPI.GetUserInfo(String userIds)
at Facebook.API.FacebookAPI.GetFriends()
at Facebook.Components.FacebookService.GetFriends()
at Facebook_App.Form1..ctor() in C:\Documents and Settings\Some Kid\My Documents\Visual Studio 2005\Projects\Facebook App\Facebook App\Form1.cs:line 21
at Facebook_App.Program.Main() in C:\Documents and Settings\Some Kid\My Documents\Visual Studio 2005\Projects\Facebook App\Facebook App\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Strangely enough, it works fine in about 1 out of about 50 attempts. Why it does this, I do not know.

Any help would be appreciated. Thanks!
Coordinator
Jul 9, 2007 at 10:11 PM
My only guess is that you have a proxy for web access on your computer. Is this so?

It seems that the webrequest is not open any more. I have seen this periodically when I try to use Fiddler or another http sniffer proxy.

Jul 14, 2007 at 10:37 PM
Edited Jul 14, 2007 at 10:44 PM
I'm experience the same ploblem, on my previous pc I didn't get this error.

I'm running on a Lenovo 3000 n100 with Vista Ultimate, VS Studio 2005 with all the vs studio vista patches.

btw, I do not use a proxy for web access.

Also, I found on the net that you can get this error if you are using MSXML (i.e. not System.XML) together with C#, is the toolkit using MSXML ?
Jul 14, 2007 at 11:13 PM
This might fix the problem/bug: http://www.aspcode.net/Unable-to-read-data-from-the-transport-connection.aspx
Jul 15, 2007 at 12:23 AM
I've narrowed it down to responseData = streamReader.ReadToEnd(); in FacebookAPI.cs


Coordinator
Jul 18, 2007 at 3:14 PM
Sorry. Been on vacation for a couple days.

I will look into this a bit more today.

I might send you directly a couple things to try. Since, this seems to be isolated to you environment.
Aug 5, 2007 at 5:21 PM

rpowers119 wrote:
Sorry. Been on vacation for a couple days.

I will look into this a bit more today.

I might send you directly a couple things to try. Since, this seems to be isolated to you environment.


I've also been away on vacation, did you send me anything ?
Coordinator
Aug 7, 2007 at 4:37 AM
I am logging an issue so I can try to look into this more. i don't remember if I did anything.
Aug 7, 2007 at 11:46 AM


rpowers119 wrote:
I am logging an issue so I can try to look into this more. i don't remember if I did anything.


I like to add that this doesn't only happend when I run my application, it also happends when I run the precompiled demo desktop application downloaded from this site. It seams like the streamReader.ReadToEnd() doesn't find the "end" of the stream.

Sep 20, 2007 at 11:38 PM
I'm getting the same exception. Any updates on this?
Sep 22, 2007 at 6:38 AM
The bug is sporadic, looks like it happens when fb session is expired or invalid. Anyway, I don't think that .NET framework should react in this way to any sort of request. I just added debug symbol server to my environment, will post the full callstack if it happens again.

Sep 23, 2007 at 4:27 AM
A first chance exception of type 'System.AccessViolationException' occurred in System.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Managed to Native Transition
System.dll!System.Net.Sockets.Socket.Receive(byte[] buffer = {Dimensions:2}, int offset = 0, int size, System.Net.Sockets.SocketFlags socketFlags = None, out System.Net.Sockets.SocketError errorCode = Success) + 0x136 bytes
System.dll!System.Net.Sockets.Socket.Receive(byte[] buffer, int offset, int size, System.Net.Sockets.SocketFlags socketFlags) + 0x1d bytes
System.dll!System.Net.Sockets.NetworkStream.Read(byte[] buffer, int offset, int size) + 0x78 bytes
System.dll!System.Net.PooledStream.Read(byte[] buffer, int offset, int size) + 0x16 bytes
System.dll!System.Net.ConnectStream.ReadSingleByte() + 0x45 bytes
System.dll!System.Net.StreamChunkBytes.NextByte.get() + 0x1b bytes
System.dll!System.Net.ChunkParse.GetChunkSize(System.Net.IReadChunkBytes Source = {System.Net.StreamChunkBytes}, out int chunkSize = 0) + 0x80 bytes
System.dll!System.Net.ConnectStream.ProcessReadChunkedSize(System.Net.StreamChunkBytes ReadByteBuffer = {System.Net.StreamChunkBytes}) + 0x18 bytes
System.dll!System.Net.ConnectStream.ReadChunkedSync(byte[] buffer = {Dimensions:1024}, int offset = 0, int size = 1024) + 0x52 bytes
System.dll!System.Net.ConnectStream.ReadWithoutValidation(byte[] buffer, int offset, int size, bool abortOnError = true) + 0x58 bytes
System.dll!System.Net.ConnectStream.Read(byte[] buffer = {Dimensions:1024}, int offset = 0, int size) + 0x134 bytes
mscorlib.dll!System.IO.StreamReader.ReadBuffer() + 0x5c bytes
mscorlib.dll!System.IO.StreamReader.ReadToEnd() + 0x5c bytes
> Facebook.DLL!Facebook.API.FacebookAPI.GetQueryResponse(string requestUrl = "http://api.facebook.com/bestserver.php", string postString = "method=facebook.fql.query&query=SELECTuid%2cfirstname%2c+lastname%2cname%2cpicsmall%2c+picbig%2cpic%2caffiliations%2cprofileupdatetime%2ctimezone%2creligion%2cbirthday%2csex%2chometownlocation%2c+meetingsex%2cmeeting_for%2crelationshipstatus%2c+significantotherid%2cpolitical%2ccurrentlocation%2cactivities%2cinterests%2cisappuser%2cmusic%2ctv%2cmovies%2cbooks%2cquotes%2cabout_me%2chsinfo%2c+educationhistory%2cwork_history%2cnotescount%2c+wallcount%2cstatusFROMuserWHEREuidIN+(519966552)&sessionkey=1e4f6a391eb2f0d6470ebe43-519966552&apikey=99d060de7949259eae8771ab4f05b278&v=1.0&call_id=8c9cb6dca665726&sig=db638d258a9eb19521ba67ca33339c7d") Line 1639 + 0x8 bytes C#
Facebook.DLL!Facebook.API.FacebookAPI.ExecuteApiCallString(System.Collections.Generic.IDictionary<string,string> parameterDictionary = Count = 7, bool useSession = true) Line 1735 + 0xc bytes C#
Facebook.DLL!Facebook.API.FacebookAPI.GetUserInfoXml(string userIds = "519966552") Line 636 + 0xd bytes C#
Facebook.DLL!Facebook.API.FacebookAPI.GetUserInfo(string userIds = "519966552") Line 583 + 0xc bytes C#
Facebook.DLL!Facebook.API.FacebookAPI.GetUserInfo(System.Collections.ObjectModel.Collection<string> userIds = Count = 1) Line 618 + 0x1b bytes C#
Facebook.DLL!Facebook.Components.FacebookService.GetUserInfo(System.Collections.ObjectModel.Collection<string> userIds = Count = 1) Line 593 + 0xd bytes C#