Hi I have a hard time understanding why the following won''t work. I started with the following xaml: <UserControl x:Class="System.Windows.Controls.UserControl" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid x:Name="layout_root" Background="White"> <TextBlock x:Name="message" FontSize="10" /> </Grid> </UserControl> and in the initialize method of App I''ve got the following code @root = Application.current.load_root_visual(UserControl.new, "app.xaml") request = Net::WebClient.new request.download_string_completed do |sender, args| @root.find_name("message").text = "Completed" end request.download_string_async Uri.new("http://google.com") This works but as you can see nothing interesting happens except for that download_string_completed is called because the message textbloc shows Completed @root = Application.current.load_root_visual(UserControl.new, "app.xaml") request = Net::WebClient.new request.download_string_completed do |sender, args| @root.find_name("message").text = *args.result* end request.download_string_async Uri.new("http://google.com") But as soon as I ask the args for the result nothing happens anymore. it must be an exception somewhere but I have no idea as to where I can find the exception or stacktrace because all it does is show me a blank page with all layout removed and the IronRuby Console in the bottom is still there but it is disabled too. So how do I get to that error? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090627/274bb9f9/attachment.html>
I''ve tried to do the same in C# var wc = new WebClient(); wc.DownloadStringCompleted += (s, e) => Message.Text = e.Result; wc.DownloadStringAsync(new Uri("http://google.com")); Which actually gives me the same result but I do get to see the error once in a while. It''s saying something about SecurityException. So I went on and tried fetching the page it with a webrequest var wr = WebRequest.Create("http://google.com"); wr.BeginGetResponse(ar => { var req = (WebRequest)ar.AsyncState; var resp = req.EndGetResponse(ar); using(var sr = new StreamReader(resp.GetResponseStream())) { var result = sr.ReadToEnd(); Message.Text = result; } }, null); This last approach also fails because AsyncState is null. Have I lost my mind? Am I doing something wrong or is it Silverlight? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sat, Jun 27, 2009 at 9:58 AM, Ivan Porto Carrero <ivan at flanders.co.nz>wrote:> Hi > I have a hard time understanding why the following won''t work. I started > with the following xaml: > > <UserControl x:Class="System.Windows.Controls.UserControl" > xmlns="http://schemas.microsoft.com/client/2007" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > <Grid x:Name="layout_root" Background="White"> > <TextBlock x:Name="message" FontSize="10" /> > </Grid> > > </UserControl> > > and in the initialize method of App I''ve got the following code > > @root = Application.current.load_root_visual(UserControl.new, "app.xaml") > request = Net::WebClient.new > request.download_string_completed do |sender, args| > @root.find_name("message").text = "Completed" > end > request.download_string_async Uri.new("http://google.com") > > > This works but as you can see nothing interesting happens except for that > download_string_completed is called because the message textbloc shows > Completed > > @root = Application.current.load_root_visual(UserControl.new, "app.xaml") > request = Net::WebClient.new > request.download_string_completed do |sender, args| > @root.find_name("message").text = *args.result* > end > request.download_string_async Uri.new("http://google.com") > > But as soon as I ask the args for the result nothing happens anymore. it > must be an exception somewhere but I have no idea as to where I can find the > exception or stacktrace because all it does is show me a blank page with all > layout removed and the IronRuby Console in the bottom is still there but it > is disabled too. > > So how do I get to that error? > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090627/61b5959b/attachment.html>
k rookie mistake I guess. google.com obviously doesn''t have a crossdomainpolicy.xml file in placeUsing the flickr url I wanted to get in the first place helps a lot. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sat, Jun 27, 2009 at 10:32 AM, Ivan Porto Carrero <ivan at flanders.co.nz>wrote:> I''ve tried to do the same in C# > > var wc = new WebClient(); > wc.DownloadStringCompleted += (s, e) => Message.Text = e.Result; > wc.DownloadStringAsync(new Uri("http://google.com")); > > Which actually gives me the same result but I do get to see the error once > in a while. It''s saying something about SecurityException. > So I went on and tried fetching the page it with a webrequest > > var wr = WebRequest.Create("http://google.com"); > wr.BeginGetResponse(ar => > { > var req > (WebRequest)ar.AsyncState; > var resp = req.EndGetResponse(ar); > using(var sr = new > StreamReader(resp.GetResponseStream())) > { > var result = sr.ReadToEnd(); > Message.Text = result; > } > }, null); > > > This last approach also fails because AsyncState is null. > Have I lost my mind? Am I doing something wrong or is it Silverlight? > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > > > On Sat, Jun 27, 2009 at 9:58 AM, Ivan Porto Carrero <ivan at flanders.co.nz>wrote: > >> Hi >> I have a hard time understanding why the following won''t work. I started >> with the following xaml: >> >> <UserControl x:Class="System.Windows.Controls.UserControl" >> xmlns="http://schemas.microsoft.com/client/2007" >> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> >> >> <Grid x:Name="layout_root" Background="White"> >> <TextBlock x:Name="message" FontSize="10" /> >> </Grid> >> >> </UserControl> >> >> and in the initialize method of App I''ve got the following code >> >> @root = Application.current.load_root_visual(UserControl.new, "app.xaml") >> request = Net::WebClient.new >> request.download_string_completed do |sender, args| >> @root.find_name("message").text = "Completed" >> end >> request.download_string_async Uri.new("http://google.com") >> >> >> This works but as you can see nothing interesting happens except for that >> download_string_completed is called because the message textbloc shows >> Completed >> >> @root = Application.current.load_root_visual(UserControl.new, "app.xaml") >> request = Net::WebClient.new >> request.download_string_completed do |sender, args| >> @root.find_name("message").text = *args.result* >> end >> request.download_string_async Uri.new("http://google.com") >> >> But as soon as I ask the args for the result nothing happens anymore. it >> must be an exception somewhere but I have no idea as to where I can find the >> exception or stacktrace because all it does is show me a blank page with all >> layout removed and the IronRuby Console in the bottom is still there but it >> is disabled too. >> >> So how do I get to that error? >> >> --- >> Met vriendelijke groeten - Best regards - Salutations >> Ivan Porto Carrero >> Blog: http://flanders.co.nz >> Twitter: http://twitter.com/casualjim >> Author of IronRuby in Action (http://manning.com/carrero) >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090627/81f03b73/attachment.html>
Yeah, the clientaccesspolicy.xml file requirement makes these things a bit annoying. This is why most JavaScript APIs are .js files hosted on the domain so they can make requests back to the domain. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Saturday, June 27, 2009 2:25 AM To: ironruby-core Subject: Re: [Ironruby-core] silverlight 3 question k rookie mistake I guess. google.com<http://google.com> obviously doesn''t have a crossdomainpolicy.xml file in place Using the flickr url I wanted to get in the first place helps a lot. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sat, Jun 27, 2009 at 10:32 AM, Ivan Porto Carrero <ivan at flanders.co.nz<mailto:ivan at flanders.co.nz>> wrote: I''ve tried to do the same in C# var wc = new WebClient(); wc.DownloadStringCompleted += (s, e) => Message.Text = e.Result; wc.DownloadStringAsync(new Uri("http://google.com")); Which actually gives me the same result but I do get to see the error once in a while. It''s saying something about SecurityException. So I went on and tried fetching the page it with a webrequest var wr = WebRequest.Create("http://google.com"); wr.BeginGetResponse(ar => { var req = (WebRequest)ar.AsyncState; var resp = req.EndGetResponse(ar); using(var sr = new StreamReader(resp.GetResponseStream())) { var result = sr.ReadToEnd(); Message.Text = result; } }, null); This last approach also fails because AsyncState is null. Have I lost my mind? Am I doing something wrong or is it Silverlight? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sat, Jun 27, 2009 at 9:58 AM, Ivan Porto Carrero <ivan at flanders.co.nz<mailto:ivan at flanders.co.nz>> wrote: Hi I have a hard time understanding why the following won''t work. I started with the following xaml: <UserControl x:Class="System.Windows.Controls.UserControl" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid x:Name="layout_root" Background="White"> <TextBlock x:Name="message" FontSize="10" /> </Grid> </UserControl> and in the initialize method of App I''ve got the following code @root = Application.current.load_root_visual(UserControl.new, "app.xaml") request = Net::WebClient.new request.download_string_completed do |sender, args| @root.find_name("message").text = "Completed" end request.download_string_async Uri.new("http://google.com") This works but as you can see nothing interesting happens except for that download_string_completed is called because the message textbloc shows Completed @root = Application.current.load_root_visual(UserControl.new, "app.xaml") request = Net::WebClient.new request.download_string_completed do |sender, args| @root.find_name("message").text = args.result end request.download_string_async Uri.new("http://google.com") But as soon as I ask the args for the result nothing happens anymore. it must be an exception somewhere but I have no idea as to where I can find the exception or stacktrace because all it does is show me a blank page with all layout removed and the IronRuby Console in the bottom is still there but it is disabled too. So how do I get to that error? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090629/a1cfcbbc/attachment.html>
What kept me most busy was the fact that I never got any error messages displayed to me, which left as only option to comment out code until i could see something again. I have a xaml that shows a background color. When an error occurs in the ruby code the background would become white. the REPL console doesn''t accept any input anymore and I have no clue as to what''s going on. So sometimes I could write the code in C# and see why things were failing. I must be missing something as I do have the following as params debug=true, console=true <param name="initParams" value="debug=true, reportErrors=errorLocation, console=true" /> So how do I see errors when they occur? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Mon, Jun 29, 2009 at 7:44 AM, Jimmy Schementi < Jimmy.Schementi at microsoft.com> wrote:> Yeah, the clientaccesspolicy.xml file requirement makes these things a bit > annoying. This is why most JavaScript APIs are .js files hosted on the > domain so they can make requests back to the domain. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Ivan Porto Carrero > *Sent:* Saturday, June 27, 2009 2:25 AM > *To:* ironruby-core > *Subject:* Re: [Ironruby-core] silverlight 3 question > > > > k rookie mistake I guess. google.com obviously doesn''t have a > crossdomainpolicy.xml file in place > > Using the flickr url I wanted to get in the first place helps a lot. > > > > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > > On Sat, Jun 27, 2009 at 10:32 AM, Ivan Porto Carrero <ivan at flanders.co.nz> > wrote: > > I''ve tried to do the same in C# > > > > var wc = new WebClient(); > > wc.DownloadStringCompleted += (s, e) => Message.Text = e.Result; > > wc.DownloadStringAsync(new Uri("http://google.com")); > > > > Which actually gives me the same result but I do get to see the error once > in a while. It''s saying something about SecurityException. > > So I went on and tried fetching the page it with a webrequest > > > > var wr = WebRequest.Create("http://google.com"); > > wr.BeginGetResponse(ar => > > { > > var req > (WebRequest)ar.AsyncState; > > var resp = req.EndGetResponse(ar); > > using(var sr = new > StreamReader(resp.GetResponseStream())) > > { > > var result = sr.ReadToEnd(); > > Message.Text = result; > > } > > }, null); > > > > > > This last approach also fails because AsyncState is null. > > Have I lost my mind? Am I doing something wrong or is it Silverlight? > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > > On Sat, Jun 27, 2009 at 9:58 AM, Ivan Porto Carrero <ivan at flanders.co.nz> > wrote: > > Hi > > > > I have a hard time understanding why the following won''t work. I started > with the following xaml: > > > > <UserControl x:Class="System.Windows.Controls.UserControl" > > xmlns="http://schemas.microsoft.com/client/2007" > > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > <Grid x:Name="layout_root" Background="White"> > > <TextBlock x:Name="message" FontSize="10" /> > > </Grid> > > > > </UserControl> > > > > and in the initialize method of App I''ve got the following code > > > > @root = Application.current.load_root_visual(UserControl.new, "app.xaml") > > request = Net::WebClient.new > > request.download_string_completed do |sender, args| > > @root.find_name("message").text = "Completed" > > end > > request.download_string_async Uri.new("http://google.com") > > > > > > This works but as you can see nothing interesting happens except for that > download_string_completed is called because the message textbloc shows > Completed > > > > @root = Application.current.load_root_visual(UserControl.new, "app.xaml") > > request = Net::WebClient.new > > request.download_string_completed do |sender, args| > > @root.find_name("message").text = *args.result* > > end > > request.download_string_async Uri.new("http://google.com") > > > > But as soon as I ask the args for the result nothing happens anymore. it > must be an exception somewhere but I have no idea as to where I can find the > exception or stacktrace because all it does is show me a blank page with all > layout removed and the IronRuby Console in the bottom is still there but it > is disabled too. > > > > So how do I get to that error? > > > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Blog: http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090629/5f4d5907/attachment.html>
Is the Silverlight control taking up the whole HTML window? If so, make sure to do <params name="windowless" value="true" /> so the error console shows up over the Silverlight app. If this doesn?t seem to fix it, mind sending me a repro? From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Monday, June 29, 2009 1:18 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] silverlight 3 question What kept me most busy was the fact that I never got any error messages displayed to me, which left as only option to comment out code until i could see something again. I have a xaml that shows a background color. When an error occurs in the ruby code the background would become white. the REPL console doesn''t accept any input anymore and I have no clue as to what''s going on. So sometimes I could write the code in C# and see why things were failing. I must be missing something as I do have the following as params debug=true, console=true <param name="initParams" value="debug=true, reportErrors=errorLocation, console=true" /> So how do I see errors when they occur? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Mon, Jun 29, 2009 at 7:44 AM, Jimmy Schementi <Jimmy.Schementi at microsoft.com<mailto:Jimmy.Schementi at microsoft.com>> wrote: Yeah, the clientaccesspolicy.xml file requirement makes these things a bit annoying. This is why most JavaScript APIs are .js files hosted on the domain so they can make requests back to the domain. From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of Ivan Porto Carrero Sent: Saturday, June 27, 2009 2:25 AM To: ironruby-core Subject: Re: [Ironruby-core] silverlight 3 question k rookie mistake I guess. google.com<http://google.com> obviously doesn''t have a crossdomainpolicy.xml file in place Using the flickr url I wanted to get in the first place helps a lot. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sat, Jun 27, 2009 at 10:32 AM, Ivan Porto Carrero <ivan at flanders.co.nz<mailto:ivan at flanders.co.nz>> wrote: I''ve tried to do the same in C# var wc = new WebClient(); wc.DownloadStringCompleted += (s, e) => Message.Text = e.Result; wc.DownloadStringAsync(new Uri("http://google.com")); Which actually gives me the same result but I do get to see the error once in a while. It''s saying something about SecurityException. So I went on and tried fetching the page it with a webrequest var wr = WebRequest.Create("http://google.com"); wr.BeginGetResponse(ar => { var req = (WebRequest)ar.AsyncState; var resp = req.EndGetResponse(ar); using(var sr = new StreamReader(resp.GetResponseStream())) { var result = sr.ReadToEnd(); Message.Text = result; } }, null); This last approach also fails because AsyncState is null. Have I lost my mind? Am I doing something wrong or is it Silverlight? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Sat, Jun 27, 2009 at 9:58 AM, Ivan Porto Carrero <ivan at flanders.co.nz<mailto:ivan at flanders.co.nz>> wrote: Hi I have a hard time understanding why the following won''t work. I started with the following xaml: <UserControl x:Class="System.Windows.Controls.UserControl" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid x:Name="layout_root" Background="White"> <TextBlock x:Name="message" FontSize="10" /> </Grid> </UserControl> and in the initialize method of App I''ve got the following code @root = Application.current.load_root_visual(UserControl.new, "app.xaml") request = Net::WebClient.new request.download_string_completed do |sender, args| @root.find_name("message").text = "Completed" end request.download_string_async Uri.new("http://google.com") This works but as you can see nothing interesting happens except for that download_string_completed is called because the message textbloc shows Completed @root = Application.current.load_root_visual(UserControl.new, "app.xaml") request = Net::WebClient.new request.download_string_completed do |sender, args| @root.find_name("message").text = args.result end request.download_string_async Uri.new("http://google.com") But as soon as I ask the args for the result nothing happens anymore. it must be an exception somewhere but I have no idea as to where I can find the exception or stacktrace because all it does is show me a blank page with all layout removed and the IronRuby Console in the bottom is still there but it is disabled too. So how do I get to that error? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090629/63e6307c/attachment.html>