MAC: Mono Helloworld example - c#

I did a fresh install of Mono on my OSX Yosemite and tried the examples on http://www.mono-project.com/docs/getting-started/mono-basics/.
The Console Hello World example runs without problem but when I tried the WindowsForm Hello World, I got the following error :
System.EntryPointNotFoundException: GdipCreateFromContext_macosx at (wrapper managed-to-native) System.Drawing.GDIPlus:GdipCreateFromContext_macosx (intptr,int,int,intptr&)
at System.Drawing.Graphics.FromHwnd (IntPtr hwnd) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUICarbon.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUI.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.ScrollableControl. at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
Chads-MacBook-Pro:C# ChadLeong$ mono hello.exe
System.EntryPointNotFoundException: GdipCreateFromContext_macosx
at (wrapper managed-to-native) System.Drawing.GDIPlus:GdipCreateFromContext_macosx (intptr,int,int,intptr&)
at System.Drawing.Graphics.FromHwnd (IntPtr hwnd) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUICarbon.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUI.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
Anyone got a clue ? Thank you!!

It's a known bug/regression in the 3.10 release: https://bugzilla.xamarin.com/show_bug.cgi?id=23553
This Xamarin forum thread provides a version with a fix: http://forums.xamarin.com/discussion/27011/fix-for-gdipcreatefromcontext-macosx-and-other-macios-gdi-issues

Related

PING ERROR C# - Parameter name: hostName

I need help.. I checking for if user of PC connected to Internet..
It works for me.. and for many people.. But for someone no
and it's writing this into output_log.txt
ERROR:
ArgumentNullException: Argument cannot be null.
Parameter name: hostName
at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.Ping.GetNonLoopbackIP () [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.Ping.SendPrivileged (System.Net.IPAddress address, Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions options) [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.Ping.Send (System.Net.IPAddress address, Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions options) [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress, Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions options) [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress, Int32 timeout, System.Byte[] buffer) [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress, Int32 timeout) [0x00000] in <filename unknown>:0
at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Net.NetworkInformation.Ping:Send (string)
at Internet.Connection.Check () [0x00000] in <filename unknown>:0
at MyGame.Load.Loader.StartLoading () [0x00000] in <filename unknown>:0
at Loader+<Start>c__IteratorA.MoveNext () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
Code:
namespace Internet
{
using System;
using System.Net.NetworkInformation;
using UnityEngine;
public class Connection
{
public static void Check()
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
if (ping.Send("89.203.249.74").Status != IPStatus.Success)
{
Debug.Log("NO INTERNET CONNECTION");
Application.Quit();
}
}
}
}
So Please help

How to fix a Memory Map Failed Exception for GPIO write on raspberry pi

I'm trying to use the Raspberry Sharp IO library to write to a pin on the Pi. But it gives me an exception on runtime. It had worked before, but doesnt any more. Why is this error being thrown?
using System;
using Raspberry.IO.GeneralPurpose;
using Raspberry.IO.GeneralPurpose.Behaviors;
using System.Threading;
namespace blinky
{
class MainClass
{
public static void Main (string[] args)
{
// Here we create a variable to address a specific pin for output
// There are two different ways of numbering pins--the physical numbering, and the CPU number
// "P1Pinxx" refers to the physical numbering, and ranges from P1Pin01-P1Pin40
var led1 = ConnectorPin.P1Pin03.Output();
// Here we create a connection to the pin we instantiated above
var connection = new GpioConnection(led1);
while(true){
// Toggle() switches the high/low (on/off) status of the pin
connection.Toggle(led1);
Thread.Sleep(250);
}
// connection.Close();
}
}
}
returns this error:
pi#Minion01 ~/blinky1/blinky1/bin/Debug $ mono ./blinky1.exe
Unhandled Exception:
Raspberry.IO.Interop.MemoryMapFailedException: Exception of type 'Raspberry.IO.Interop.MemoryMapFailedException' was thrown.
at Raspberry.IO.Interop.MemoryMap.ThrowOnError[MemoryMapFailedException] (IntPtr result) [0x00000] in <filename unknown>:0
at Raspberry.IO.Interop.MemoryMap.Create (IntPtr address, UInt32 size, MemoryProtection protection, MemoryFlags memoryflags, Int32 fileDescriptor, UInt32 offset) [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionDriver..ctor () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings.GetBestDriver (GpioConnectionDriverCapabilities capabilities) [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings.get_DefaultDriver () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings..ctor () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnection..ctor (Raspberry.IO.GeneralPurpose.GpioConnectionSettings settings, IEnumerable`1 pins) [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnection..ctor (Raspberry.IO.GeneralPurpose.PinConfiguration[] pins) [0x00000] in <filename unknown>:0
at blinky.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Raspberry.IO.Interop.MemoryMapFailedException: Exception of type 'Raspberry.IO.Interop.MemoryMapFailedException' was thrown.
at Raspberry.IO.Interop.MemoryMap.ThrowOnError[MemoryMapFailedException] (IntPtr result) [0x00000] in <filename unknown>:0
at Raspberry.IO.Interop.MemoryMap.Create (IntPtr address, UInt32 size, MemoryProtection protection, MemoryFlags memoryflags, Int32 fileDescriptor, UInt32 offset) [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionDriver..ctor () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings.GetBestDriver (GpioConnectionDriverCapabilities capabilities) [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings.get_DefaultDriver () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnectionSettings..ctor () [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnection..ctor (Raspberry.IO.GeneralPurpose.GpioConnectionSettings settings, IEnumerable`1 pins) [0x00000] in <filename unknown>:0
at Raspberry.IO.GeneralPurpose.GpioConnection..ctor (Raspberry.IO.GeneralPurpose.PinConfiguration[] pins) [0x00000] in <filename unknown>:0
at blinky.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
How may i fix it?
I had tried to run this through monodevelop on the pi and also using mono filename.exe . Neither worked. But it did when I used sudo ./filename.exe.

How is ording a List of objects handled with Linq and or Sort?

Sorry if this is a duplicate. I'm having a hard time finding an answer because I get so much bloat of people asking how to sort lists in general in my search results.
Say I have a property like this:
public List<object> Hello { get; set; }
Say each element in the list is of the same nullable primitive data type.
So every element is a int? or every element is a decimal? or every element is a DateTime?, etc
What exactly happens if I invoke a Sort or OrderBy on this list? Does it sort based on the underlying type of each element or does it order by the string value of the property?
Let's check http://ideone.com/kcXmHE:
System.ArgumentException: Value does not fall within the expected range.
at System.String.CompareTo (System.Object value) [0x00000] in <filename unknown>:0
at System.Collections.Generic.Comparer`1+DefaultComparer[System.Object].Compare (System.Object x, System.Object y) [0x00000] in <filename unknown>:0
at System.Linq.SortSequenceContext`2[System.Object,System.Object].Compare (Int32 first_index, Int32 second_index) [0x00000] in <filename unknown>:0
at System.Array.qsort[Int32] (System.Int32[] keys, Int32 low0, Int32 high0, IComparer`1 comparer) [0x00000] in <filename unknown>:0
at System.Array.SortImpl[Int32] (System.Int32[] keys, Int32 index, Int32 length, IComparer`1 comparer) [0x00000] in <filename unknown>:0
at System.Array.Sort[Int32] (System.Int32[] array, IComparer`1 comparer) [0x00000] in <filename unknown>:0
at System.Linq.QuickSort`1[System.Object].PerformSort () [0x00000] in <filename unknown>:0
at System.Linq.QuickSort`1+<Sort>c__Iterator0[System.Object].MoveNext () [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1[System.Object]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.ToList[Object] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at Test.Main () [0x00000] in <filename unknown>:0
So, LINQ uses default comparer for element of list (for string value you can see System.String.CompareTo) and tries to compare with another value (of object type). And, can't do it.
If you change order of elements in initial list (http://ideone.com/foljli), you will get another stack trace:
System.ArgumentException: Object must be of type Int32.
at System.Int32.CompareTo (System.Object value) [0x00000] in <filename unknown>:0
at System.Collections.Generic.Comparer`1+DefaultComparer[System.Object].Compare (System.Object x, System.Object y) [0x00000] in <filename unknown>:0
at System.Linq.SortSequenceContext`2[System.Object,System.Object].Compare (Int32 first_index, Int32 second_index) [0x00000] in <filename unknown>:0
at System.Array.qsort[Int32] (System.Int32[] keys, Int32 low0, Int32 high0, IComparer`1 comparer) [0x00000] in <filename unknown>:0
at System.Array.SortImpl[Int32] (System.Int32[] keys, Int32 index, Int32 length, IComparer`1 comparer) [0x00000] in <filename unknown>:0
at System.Array.Sort[Int32] (System.Int32[] array, IComparer`1 comparer) [0x00000] in <filename unknown>:0
at System.Linq.QuickSort`1[System.Object].PerformSort () [0x00000] in <filename unknown>:0
at System.Linq.QuickSort`1+<Sort>c__Iterator0[System.Object].MoveNext () [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1[System.Object]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.ToList[Object] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at Test.Main () [0x00000] in <filename unknown>:0
Now, LINQ takes int32 and tries to compare with object. And fail again. Because int32 type has no method CompareTo(object)

ObjectDisposedException when selecting DataGridView cells?

I think I have found a bug in mono, but I have not isolated it completely, I need help to isolate my problem.
To reproduce this error
run csharp HelloWorld.cs
click any cell
modify the contents of that cell.
click on any other cell.
NOTE: I think my question is related to this question but is closer to isolating the problem.
Note: I have tried this on mono 3.0.4 and mono 3.0.1 and mono 2.10.x on linux
NOTE 2: I have also tried compiling this into a .exe and it still has the same errors
It will produce this call trace message:
System.ObjectDisposedException: The object was used after being disposed.
at System.Windows.Forms.Control.CreateHandle () [0x00000] in <filename unknown>:0
at System.Windows.Forms.TextBoxBase.CreateHandle () [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.CreateControl () [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.SetVisibleCore (Boolean value) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.set_Visible (Boolean value) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:set_Visible (bool)
at System.Windows.Forms.DataGridView.BeginEdit (Boolean selectAll) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore (Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.OnMouseDown (System.Windows.Forms.MouseEventArgs e) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.WmLButtonDblClick (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
System.ArgumentOutOfRangeException: Index is less than 0 or more than or equal to the list count.
Parameter name: index
0
at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException (System.String name, System.Object actual, System.String message) [0x00000] in <filename unknown>:0
at System.Collections.ArrayList.get_Item (Int32 index) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridViewRowCollection.SharedRow (Int32 rowIndex) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.GetRowInternal (Int32 rowIndex) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.GetCellInternal (Int32 colIndex, Int32 rowIndex) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.OnCellLeave (System.Windows.Forms.DataGridViewCellEventArgs e) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore (Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.MoveCurrentCell (Int32 x, Int32 y, Boolean select, Boolean isControl, Boolean isShift, Boolean scroll) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.OnColumnCollectionChanged (System.Object sender, System.ComponentModel.CollectionChangeEventArgs e) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridViewColumnCollection.OnCollectionChanged (System.ComponentModel.CollectionChangeEventArgs e) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridViewColumnCollection.Clear () [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
at System.ComponentModel.Component.Dispose () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.ComponentModel.Component:Dispose ()
at System.Windows.Forms.Control.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
at System.Windows.Forms.ContainerControl.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Form.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
at System.ComponentModel.Component.Dispose () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.ComponentModel.Component:Dispose ()
at System.Windows.Forms.Form.WmClose (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
contents of HelloWorld.cs:
using System.Data;
using System.Drawing;
using System.Windows.Forms;
public class HelloWorld : Form {
public HelloWorld () {
Button quit = new Button ();
quit.Text = "quit";
quit.Click += new EventHandler (OnClickQuit);
quit.Location = new Point(500, 400);
DataGridView dgv = new DataGridView();
dgv.AutoSize = true;
DataTable table1 = new DataTable("patients");
table1.Columns.Add("name");
table1.Columns.Add("id");
table1.Rows.Add("sam", 1);
table1.Rows.Add("mark", 2);
DataSet ds = new DataSet("office");
ds.Tables.Add(table1);
dgv.DataSource = ds;
dgv.DataMember = ds.Tables[0].TableName;
Controls.AddRange(new Control[] { dgv, quit });
}
void OnClickQuit(object sender, EventArgs e) {
Close();
}
}
Application.Run (new HelloWorld ());

MonoDroid ObjectDisposedException when loading XDocument for RSS

I'm fiddling with MonoDroid (aka Mono for Android) trying to build a simple podcast downloading app, currently just testing out retrieval of an RSS feed contents.
My simple app is:
an edit text where the url for an RSS feed is input
a button to 'download' the rss
a text display for the output of the download operation
When a user clicks on download, I fetch the RSS contents, currently using XDocument (I also tried with just WebRequest / Streams etc.), here's the short version:
void button_Click(object sender, EventArgs e)
{
output.Text += "user input: " + rssUriInput.Text + "\n";
try
{
output.Text += "### document ###";
output.Text += XDocument.Load(rssUriInput.Text).ToString();
output.Text += "### document ###";
}
catch (Exception ex)
{
output.Text += "OOOPS something went wrong:\n" + ex.ToString();
}
}
I've tried several approaches, but keep getting ObjectDisposedExceptions when I do XDocument.Load(/*my uri here*/);
My AssemblyInfo.cs includes the
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
Now, disclaimer, after getting hello world running I kind of went off on my own, so I may be missing some MonoDroid fundamentals, but this code works in a normal C# app (I tested it) but
Why am I doing wrong here? Do I have to do something special to use xml / linq / network access in MonoDroid?
here is the full activity code:
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using System.Xml.Linq;
namespace RssDownlowd
{
[Activity(Label = "RssDownlowd", MainLauncher = true, Icon = "#drawable/icon")]
public class Activity1 : Activity
{
EditText rssUriInput;
Button button;
TextView output;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.RssDownload);
rssUriInput = FindViewById<EditText>(Resource.Id.rssUriText);
button = FindViewById<Button>(Resource.Id.downloadButton);
output = FindViewById<TextView>(Resource.Id.outputTextView);
button.Click += new EventHandler(button_Click);
}
void button_Click(object sender, EventArgs e)
{
output.Text += "user input: " + rssUriInput.Text + "\n";
try
{
output.Text += "### document ###";
output.Text += XDocument.Load(rssUriInput.Text).ToString();
output.Text += "### document ###";
}
catch (Exception ex)
{
output.Text += "OOOPS something went wrong:\n" + ex.ToString();
}
}
}
}
And here is the full exception:
"System.ObjectDisposedException: The object was used after being disposed.
at System.Net.WebConnection.BeginRead (System.Net.HttpWebRequest request, System.Byte[] buffer, Int32 offset, Int32 size, System.AsyncCallback cb, System.Object state) [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream.BeginRead (System.Byte[] buffer, Int32 offset, Int32 size, System.AsyncCallback cb, System.Object state) [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at System.Xml.XmlInputStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
at System.Xml.NonBlockingStreamReader.ReadBuffer () [0x00000] in <filename unknown>:0
at System.Xml.NonBlockingStreamReader.Read (System.Char[] dest_buffer, Int32 index, Int32 count) [0x00000] in <filename unknown>:0
at System.Xml.XmlStreamReader.Read (System.Char[] dest_buffer, Int32 index, Int32 count) [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.PeekChar () [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.ReadChar () [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.Expect (Int32 expected) [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.ReadEntityReference (Boolean ignoreEntityReferences) [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.ReadReference (Boolean ignoreEntityReferences) [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
at Mono.Xml.XmlFilterReader.Read () [0x00000] in <filename unknown>:0
at System.Xml.Linq.XElement.LoadCore (System.Xml.XmlReader r, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XNode.ReadFrom (System.Xml.XmlReader r, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader reader, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XElement.LoadCore (System.Xml.XmlReader r, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XNode.ReadFrom (System.Xml.XmlReader r, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader reader, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XElement.LoadCore (System.Xml.XmlReader r, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XNode.ReadFrom (System.Xml.XmlReader r, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader reader, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XElement.LoadCore (System.Xml.XmlReader r, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XNode.ReadFrom (System.Xml.XmlReader r, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader reader, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XDocument.ReadContent (System.Xml.XmlReader reader, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XDocument.LoadCore (System.Xml.XmlReader reader, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XDocument.Load (System.String uri, LoadOptions options) [0x00000] in <filename unknown>:0
at System.Xml.Linq.XDocument.Load (System.String uri) [0x00000] in <filename unknown>:0
at RssDownlowd.Activity1.button_Click (System.Object sender, System.EventArgs e) [0x0004a] in C:\\Users\\khd483\\code\\HelloMonoDroid\\RssDownlowd\\Activity1.cs:47 "
Strangely enough when I tried your code it worked just fine:
Have you enabled Linking in your project in the Mono for Android options?
Also consider doing an async download of the RSS as it blocks the UI Thread until it is done, making the app unresponsive.

Categories