Application output doesn't log properly

Amir-JAmir-J USMember ✭✭

Hey guys,

I have a rather frustrating situation. Application output doesn't log all the times. Some times it does, some times it doesn't. I have tried nearly every possible way for the past few hours.

I clean project, remove content from bin folder, restart the whole IDE. It still doesn't work.

Here is a simple situation,

Brand new iOS native App
iOS Simulator (I have tried 5 different simulators and iOS versions including, 6, 6s, iOS 9.3, 9.2 10 and 10.2)
Build Debug mode

I make a simple buttons that when clicked on it does:

Console.WriteLine ("test");

It won't log anything. Basically, the application and even the generic debug OS content only shows up in the application output only if I have completely cleaned the project, manually removed the content of bin folder and restarted XS. Even then, a Console.WriteLine that is in the ViewDidLoad will print but then one in a method for a button just won't.

I am using Xamarin 6.2.1 (build 3) and I can't tell you how frustrating it is. When I have an error or when the application crashes, I simply don't get any logs to understand what's wrong.

Any advice would be great
A

Answers

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    Possibly this bug? https://bugzilla.xamarin.com/show_bug.cgi?id=52308
    The bug is marked as fixed but the fix has not been merged into a released version of Xamarin.iOS yet. There is a workaround you can use in the comments:
    https://bugzilla.xamarin.com/show_bug.cgi?id=52308#c9

  • Amir-JAmir-J USMember ✭✭

    Hi Jon,

    That's the same bug. I am working on an app with backend and constantly need to check if there are issues, so I ended up writing a solution for myself.

    showTextView ("Some value to show");

        private void showTextView(String valStr)
        {
            UITextView toastTextView = new UITextView();
            CoreGraphics.CGRect textViewFrame = View.Frame;
            textViewFrame.Size = new CoreGraphics.CGSize(textViewFrame.Size.Width * .9f, textViewFrame.Size.Height * .6f);
            toastTextView.BackgroundColor = UIColor.LightGray;
            toastTextView.Text = valStr;
            toastTextView.Frame = textViewFrame;
            toastTextView.Center = View.Center;
            UIButton dismissButton = new UIButton();
            dismissButton.Frame = new CoreGraphics.CGRect(0, textViewFrame.Size.Height - 40, textViewFrame.Size.Width, 40);
            dismissButton.BackgroundColor = UIColor.DarkGray;
            dismissButton.SetTitle("Dismiss", UIControlState.Normal);
            dismissButton.TouchUpInside += (object sender, EventArgs e) =
            {
                toastTextView.RemoveFromSuperview();
            };
    
            toastTextView.AddSubview(dismissButton);
            View.AddSubview(toastTextView);
        }
    

    I don't know if it'll help anyone, but I though I'd share it.

Sign In or Register to comment.