[Mono-bugs] [Bug 694862] Synchronous Web-Service (.Net 2.0) call becomes stuck if more than 1 MB is to transmitted
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Aug 3 04:33:08 EDT 2011
https://bugzilla.novell.com/show_bug.cgi?id=694862
https://bugzilla.novell.com/show_bug.cgi?id=694862#c6
Franz-Gerold Url <gerold.url at efm.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
InfoProvider|gerold.url at efm.at |
--- Comment #6 from Franz-Gerold Url <gerold.url at efm.at> 2011-08-03 08:33:04 UTC ---
Ok, here is the code:
This are code snippets. I didn't tried it in this short form, only with the
whole framework.
// === SERVER ===
#region Testing WEB methods
-----------------------------------------------------
[WebMethod]
public byte[] TestWsHugeReturnConfigurable(float sizeInMegabyte)
{
int size = Convert.ToInt32(sizeInMegabyte * 1024f * 1024f);
byte[] myByteArray = new byte[size];
return myByteArray;
}
#endregion WEB Methods
// === CLIENT ===
TestWebS.Service1 myWebS = new TestWebS.Service1();
myWebS.Timeout = 50000;
DateTime DT = DateTime.Now;
try
{
float v = 5f; // 5 MB
byte[] bigRetVal = myWebS.TestWsHugeReturnConfigurable(v);
{
catch(Exception ex) {
string msg = Toolkit.GetExceptionStr(ex, Toolkit.ShowTime(DT,
DateTime.Now));
Toolkit.showMsgBox(msg);
}
// --- Toolkit Funktions ----
public static bool MsgBoxMutex = true;
public static string GetExceptionStr(Exception ex)
{
return GetExceptionStr(ex, 1);
}
public static string GetExceptionStr(Exception ex, string time)
{
return "Time: " + time + "\n\n" + GetExceptionStr(ex);
}
private static string GetExceptionStr(Exception ex, int depth)
{
string msg = depth == 1 ? "" : "\n\n\n";
msg += "Error (" + depth.ToString() + ")\n";
msg += ex.Message == "" ? "no message" : ex.Message;
msg += "\n\nSource:\n;";
msg += ex.Source == "" ? "no source" : ex.Source;
msg += "\n\nType:\n";
msg += ex.GetType() == null ? "no type" : ex.GetType().ToString();
msg += "\n\nTargetSite:\n";
msg += ex.TargetSite == null ? "no targetsite" :
ex.TargetSite.ToString();
msg += "\n\nTrace:\n";
msg += ex.StackTrace == "" ? "no trace" : ex.StackTrace;
if(ex.InnerException != null) msg +=
GetExceptionStr(ex.InnerException, ++depth);
return msg;
}
public static string ShowTime(DateTime dt1, DateTime dt2)
{
if(dt1.Year == 1) return "";
if(dt2.Year == 1) return "";
TimeSpan sp = dt2.Subtract(dt1);
return sp.TotalMilliseconds.ToString() + " ms";
}
public static void showMsgBox(string txt)
{
Toolkit.showMsgBox(txt, "");
}
public static void showMsgBox(string txt, string title)
{
if(txt == null) txt = "ERROR showMsgBox: The given txt is null";
UIAlertView av = new UIAlertView();
av.Message = txt;
av.Title = title;
av.AddButton("OK");
av.Delegate = new MyMsgBoxDelegate();
av.Show();
Toolkit.WaitFor(ref Toolkit.MsgBoxMutex, 50);
}
public static void WaitFor(ref bool wait, int SleepTime)
{
wait = true;
while(wait)
{
NSRunLoop.Current.LimitDateForMode(NSRunLoopMode.Default);
if(SleepTime>0)
Thread.Sleep(SleepTime);
}
}
// --------------------------------------------------------------------
public class MyMsgBoxDelegate : UIAlertViewDelegate
{
public override void Clicked (UIAlertView alertview, int
buttonIndex)
{
//Toolkit.MsgBoxIdx = buttonIndex;
Toolkit.MsgBoxMutex = false;
}
public override void Canceled (UIAlertView alertView)
{
//Toolkit.MsgBoxIdx = -1;
Toolkit.MsgBoxMutex = false;
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list