Viewport display mode control - mac c# plugin

Hello,

I am trying to determine the existing setting of a viewport via the below method (which works in c# windows) but have found that no values are returned when the same code is executed on a mac. (ie. all processes halt when executing the method in a successfully compiled mac plugin).

I have isolated the problem to this line.

String displaymode_this = doc_actual.Views.ActiveView.ActiveViewport.DisplayMode.EnglishName;

Notes:

  1. I believe that I understand the differences in use of ‘doc’ from windows to mac environments - but maybe not!

  2. doc_actual is my own class level variable used to capture the incoming doc from RunCommand for reuse in a series of functions.

  3. I’ve tried other variations of the method in lieu of the failing line - also without luck. (ie. String test_this = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.DisplayMode.EnglishName;)

  4. Below is a more complete view of the function / code that fails at the above mentioned line.

     public void findDisplayMode()
     {
    
             DisplayModeDescription[] displaymodes_types = DisplayModeDescription.GetDisplayModes();
    
             Int32 display_modes_count = displaymodes_types.Length;
    
             String[] displaymodes_english = new String[display_modes_count];
    
             for (int i = 0; i < display_modes_count; i++)
             {
                     displaymodes_english[i] = displaymodes_types[i].EnglishName;
             }
    
    
             Int32 displayMode_index = 0;
    
             // Code works up until the next line - then it halts.
    
             String displaymode_this = doc_actual.Views.ActiveView.ActiveViewport.DisplayMode.EnglishName;
    
             for (int i = 0; i < display_modes_count; i++)
             {
                     if (displaymodes_english[i].Equals(displaymode_this))
                     {
                             displayMode_index = i;
                     }
    
             }
    
            // use of displayMode_index removed for example.
    
     }