gregoriusxu / booksleeve

Automatically exported from code.google.com/p/booksleeve
Other
0 stars 0 forks source link

Make booksleeve compile under mono 2.10 #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Open Booksleeve project in Monodevelop 3.0.3.2 (Mono 2.10.8.1)
2.Change project to compile in target framework Mono / .Net $.)
3.Disable Assembly Signing

What is the expected output? What do you see instead?

I got a compilation error:

/home/michael/dev/booksleeve/BookSleeve/RedisConnectionBase.cs(310,40): error 
CS1061: Type `System.Net.Sockets.SocketAsyncEventArgs' does not contain a 
definition for `ConnectSocket' and no extension method `ConnectSocket' of type 
`System.Net.Sockets.SocketAsyncEventArgs' could be found (are you missing a 
using directive or an assembly reference?)

What version of the product are you using? On what operating system?

I'm compiling the head revision
The OS is Ubuntu 13.04

Please provide any additional information below.

I changed the RedisConnectionBase class to make the project compile
Here is the output of "hg diff"

@@ -10,9 +10,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>BookSleeve</RootNamespace>
     <AssemblyName>BookSleeve</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
-    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -34,9 +32,6 @@
     <DocumentationFile>bin\Release\BookSleeve.xml</DocumentationFile>
   </PropertyGroup>
   <PropertyGroup>
-    <SignAssembly>true</SignAssembly>
-  </PropertyGroup>
-  <PropertyGroup>
     <AssemblyOriginatorKeyFile>BookSleeve.pfx</AssemblyOriginatorKeyFile>
   </PropertyGroup>
   <ItemGroup>
diff -r 12677b78dd2b BookSleeve/RedisConnectionBase.cs
--- a/BookSleeve/RedisConnectionBase.cs Sat May 11 19:56:53 2013 +0100
+++ b/BookSleeve/RedisConnectionBase.cs Sun May 12 09:13:22 2013 -0400
@@ -191,10 +191,12 @@
             catch { }
             try { if (outBuffer != null) outBuffer.Dispose(); }
             catch { }
-            try { if (socket != null) {                
+            try { if (socket != null) {
+                if (socket.Connected) {
                 Trace("dispose", "closing socket...");
                 socket.Shutdown(SocketShutdown.Both);
                 socket.Close();
+            }
                 socket.Dispose();
                 Trace("dispose", "closed socket");                
             } } catch (Exception ex){
@@ -285,7 +287,7 @@
         private void ConnectAsync(TaskCompletionSource<bool> source)
         {
             Trace("> connect", "async");
-            var socket = new Socket(AddressFamily.InterNetwork, 
SocketType.Stream, ProtocolType.Tcp);
+            socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, 
ProtocolType.Tcp);
             socket.NoDelay = true;
             socket.SendTimeout = this.ioTimeout;
             var args = new SocketAsyncEventArgs {
@@ -305,7 +307,6 @@
                 switch (args.SocketError)
                 {
                     case SocketError.Success:
-                        this.socket = args.ConnectSocket;
                         var readArgs = new SocketAsyncEventArgs();
                         readArgs.Completed += this.AsyncReadCompleted;
                         readArgs.SetBuffer(buffer, 0, buffer.Length);

Original issue reported on code.google.com by michael....@gmail.com on 12 May 2013 at 1:15

GoogleCodeExporter commented 8 years ago
I filed a bug into mono bugtracker for the missing API:
https://bugzilla.xamarin.com/show_bug.cgi?id=12211

Original comment by michael....@gmail.com on 12 May 2013 at 1:29

GoogleCodeExporter commented 8 years ago
Thanks. Will look at mono build this week. Thanks for your info on the fix.

Original comment by marc.gravell on 12 May 2013 at 1:30

GoogleCodeExporter commented 8 years ago
Fixed; notes:

- I specifically don't want socket assigned before connection, so I've fixed 
used a slightly different fix
- I want the core library to be signed during my builds, so I have *not* 
removed the code-signing instructions
- I've also added an example script for building under Mono at the command-line

Original comment by marc.gravell on 13 May 2013 at 7:33