c# - error : Unable to perform runtime binding (when location/hometown/any setting is not set in facebook profile) -
I am facing an error
Runtime binding on an empty reference Description: An uncontrolled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it has been started in the code. Exception Description: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Can not bind the runtime on an empty reference Source error: Line 27: lblBirthday.Text = (MyInfo.birthday == Null? String: empty: date time purse (myInfo.birthday). Toaster ("dd-MMM-yy")); Line 28: lblHometown.Text = (myInfo.hometown.name == empty? String.Empty: myInfo.hometown.name); Line 29: LBL location. Text = (myInfo.location.name == zero? String. Empty: myInfo.location.name); line 30: pnlHello.Visible = true; Line 31:} Here's my code: (And also for similar members.) It is a bit of a pain, of course, but basically you have to do anything to eat The need to be zero can be sure that you do not try dereference.
var fb = New FacebookWebClient (); Dynamic myInfo = fb.Get ("me"); LblName.Text = myInfo.name; ImgProfile.ImageUrl = "https://graph.facebook.com/" + myInfo.id + "/ photo"; LblBirthday.Text = (myInfo.birthday == zero? String. Empty: datetime purse purse (myInfo.birthday). Ostring ("DD-MMM-or"); LblHometown.Text = (myInfo.hometown.name == Zero? String.Empty: myInfo.hometown.name); LblLocation.Text = (myInfo.location.name == empty? String.Empty: myInfo.location.name); PnlHello.Visible = True; First check for
myInfo.location : / P>
lblLocation.Text = myInfo.location == Faucet? "": MyInfo.location.name ?? "";
Comments
Post a Comment