locked
Console.WriteLine blank in device log RRS feed

  • Question

  • User117231 posted

    I had been using Console.WriteLine and the device log to monitor the app but Console.WriteLine messages are no longer showing on the device log. The timestamp is there but the message is blank.

    Xamarin Studio Indie Version 6.1.3 (build 19)

    Apple Developer Tools Xcode 8.2.1 (11766.1)

    Xamarin.iOS Version: 10.3.1.7 (Xamarin Indie)

    Operating System Mac OS X 10.12.2

    Wednesday, January 11, 2017 12:38 AM

All replies

  • User98357 posted

    I've also discovered this problem...

    Friday, February 17, 2017 5:09 AM
  • User234068 posted

    I also seem to be getting this. I've been tearing my hair out trying to figure out why I couldn't find my log messages but after finding this Forum post it explains why I keep finding blank messages in the log. It is making debugging my Today Extension impossible!

    Wednesday, February 22, 2017 10:44 AM
  • User51603 posted

    I am having the same issue, I must test some cases including opening the app from a link when the app is not running, I have to debug it but can't see debug info from xcode console log..it doesn't show anything about my app(debug config). I enabled debugging, defined debug symbols and set to debug info to full. Strip native debugging symbols is unchecked. Please help!

    === Xamarin Studio Community ===

    Version 6.1.5 (build 0) Installation UUID: 3e137f12-4510-4e3a-b13e-63bc3fac9a8c Runtime: Mono 4.6.2 (mono-4.6.0-branch/ac9e222) (64-bit) GTK+ 2.24.23 (Raleigh theme)

    Package version: 406020016 === NuGet ===

    Version: 3.4.3.0

    === Xamarin.Profiler ===

    Version: 1.0.0 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

    === Apple Developer Tools ===

    Xcode 8.2.1 (11766.1) Build 8C1002

    === Xamarin.iOS ===

    Version: 10.3.1.8 (Xamarin Studio Community) Hash: 7beaef4 Branch: cycle8-xi Build date: 2016-12-20 02:58:14-0500

    === Xamarin.Android ===

    Version: 7.0.2.42 (Xamarin Studio Community) Android SDK: /Users/onur.hazar/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 4.4 (API level 19) 5.1 (API level 22) 6.0 (API level 23) 7.0 (API level 24)

    SDK Tools Version: 25.2.5 SDK Platform Tools Version: 25.0.3 SDK Build Tools Version: 25.0.2

    Java SDK: /usr java version "1.8.045" Java(TM) SE Runtime Environment (build 1.8.045-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

    Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

    === Xamarin Android Player ===

    Not Installed

    === Xamarin.Mac ===

    Version: 2.10.0.120 (Xamarin Studio Community)

    === Xamarin Inspector ===

    Version: 1.0.0.0 Hash: 1f3067d Branch: master Build date: 11/16/2016 12:13:59 AM

    === Build Information ===

    Release ID: 601050000 Git revision: 7494718e127af9eaec45a3bd6282d3da927488bd Build date: 2017-01-17 10:31:01-05 Xamarin addins: c92d0626d347aaa02839689eaac2961d24c9f446 Build lane: monodevelop-lion-cycle8

    === Operating System ===

    Mac OS X 10.11.6 Darwin adb-macmini01.local 15.6.0 Darwin Kernel Version 15.6.0 Thu Sep 1 15:01:16 PDT 2016 root:xnu-3248.60.11~2/RELEASEX8664 x86_64

    === Enabled user installed addins ===

    MvvmCross Template pack 1.2.6 Xamarin Inspector 1.0.0.0 XamlStyler 1.0.3

    Thursday, February 23, 2017 1:39 PM
  • User51603 posted

    I think there is a problem on iOS 10 devices while showing debug information on xcode device log. Its working on iOS 9 devices.

    https://bugzilla.xamarin.com/show_bug.cgi?id=52308

    Thursday, February 23, 2017 1:43 PM
  • User116733 posted

    So this is fixed according to the bug report but it hasn't made it into stable release yet, has anyone got a workaround ? Anyone worked out how to use NSLog directly if that may help?

    Tuesday, March 21, 2017 11:33 AM
  • User21936 posted

    @Neil-Pepper,

    You can workaround this by P/Invoking into NSLog in the Foundation framework. See this SO discussion.

    I tested this version and it worked as expected:

    [DllImport("/System/Library/Frameworks/Foundation.framework/Foundation")]
    public extern static void NSLog(IntPtr format, IntPtr arg1);
    

    then call it with:

    NSString p1 = new NSString("%@"); // the format string.
    NSString p2 = new NSString("Hello NSLog!"); // Your log message
    NSLog(p1.Handle, p2.Handle);
    

    EDIT: Sorry I was just informed that the above will not work on a 64 bit device: https://bugzilla.xamarin.com/show_bug.cgi?id=52308#c8

    Wednesday, March 22, 2017 1:28 AM
  • User18414 posted

    Same issue for me. I can not see my console logs.

    Thursday, March 23, 2017 1:01 PM
  • User21936 posted

    New workaround posted on bug report to work with 64 bit device(Thanks Nate Cook!)

    const string FoundationLibrary = "/System/Library/Frameworks/Foundation.framework/Foundation";
    
     [System.Runtime.InteropServices.DllImport(FoundationLibrary)]
     extern static void NSLog(IntPtr format, IntPtr s);
    
     [System.Runtime.InteropServices.DllImport(FoundationLibrary, EntryPoint = "NSLog")]
     extern static void NSLog_ARM64(IntPtr format, IntPtr p2, IntPtr p3, IntPtr p4, IntPtr p5, IntPtr p6, IntPtr p7, IntPtr p8, IntPtr s);
    
     static readonly bool Is64Bit = IntPtr.Size == 8;
     static readonly bool IsDevice = ObjCRuntime.Runtime.Arch == ObjCRuntime.Arch.DEVICE;
    
     static readonly Foundation.NSString nsFormat = new Foundation.NSString(@"%@");
    
     static void OutputStringToConsole(string text)
     {
          using (var nsText = new Foundation.NSString(text))
          {
                if (IsDevice && Is64Bit)
                {
                    NSLog_ARM64(nsFormat.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, nsText.Handle);
                 }
                else
                {
                    NSLog(nsFormat.Handle, nsText.Handle);
                }
            }
    }
    
    Friday, March 24, 2017 1:54 AM
  • User3151 posted

    Awesome @JGoldberger

    Friday, March 24, 2017 7:08 PM