예제 #1
0
        public void Dispose()
        {
            if (this.state != EventSourceActivity.State.Started)
            {
                return;
            }
            EmptyStruct data = new EmptyStruct();

            this.Stop <EmptyStruct>((string)null, ref data);
        }
예제 #2
0
    public static int test_0_marshal_empty_struct()
    {
        EmptyStruct es = new EmptyStruct();

        if (mono_test_empty_struct(1, es, 2) != 0)
        {
            return(1);
        }

        return(0);
    }
예제 #3
0
    public static int test_0_valuetype_invokes()
    {
        EmptyStruct es = default(EmptyStruct);

        es.value = 100;

        var ar1 = (ActionRef)Delegate.CreateDelegate(typeof(ActionRef), typeof(EmptyStruct).GetMethod("test"));

        if (ar1(ref es) != 110)
        {
            Console.WriteLine("expected 110, got {0}", ar1(ref es));
            return(1);
        }

        var ar2 = (ActionRef2)Delegate.CreateDelegate(typeof(ActionRef2), null, typeof(EmptyStruct).GetMethod("test"));

        try {
            Console.WriteLine("must not return, got {0}", ar2());
            return(2);
        } catch (NullReferenceException) {
        }

        ar1 = (ActionRef)Delegate.CreateDelegate(typeof(ActionRef), typeof(EmptyStruct).GetMethod("test2"));
        if (ar1(ref es) != 120)
        {
            Console.WriteLine("expected 120, got {0}", ar1(ref es));
            return(3);
        }

        ar2 = (ActionRef2)Delegate.CreateDelegate(typeof(ActionRef2), es, typeof(EmptyStruct).GetMethod("test"));
        if (ar2() != 110)
        {
            Console.WriteLine("expected 110 got {0}", ar2());
            return(4);
        }

        try {
            Delegate.CreateDelegate(typeof(ActionRef2), new EmptyStruct(), typeof(EmptyStruct).GetMethod("test2"));
            Console.WriteLine("must fail/2");
            return(5);
        } catch (ArgumentException) {}

        try {
            Delegate.CreateDelegate(typeof(ActionRef3), typeof(EmptyStruct).GetMethod("test"));
            Console.WriteLine("must fail/2");
            return(6);
        } catch (ArgumentException) {}

        return(0);
    }
        public void EmptyAndNull()
        {
            var o = new EmptyClass();

            Convert(o).IsStructuralEqual(o);
            o = null;
            var r = Convert(o);

            r.IsStructuralEqual(o);

            var o2 = new EmptyStruct();

            Convert(o2).IsStructuralEqual(o2);
        }
예제 #5
0
 private void WriteEvent(string eventName, EventMetadata metadata, ref EventSourceOptions options)
 {
     if (metadata != null)
     {
         JsonPayload payload = new JsonPayload(metadata);
         EventSource.SetCurrentThreadActivityId(this.activityId);
         this.EvtSource.Write(eventName, ref options, ref this.activityId, ref this.parentActivityId, ref payload);
     }
     else
     {
         EmptyStruct payload = new EmptyStruct();
         EventSource.SetCurrentThreadActivityId(this.activityId);
         this.EvtSource.Write(eventName, ref options, ref this.activityId, ref this.parentActivityId, ref payload);
     }
 }
예제 #6
0
            public void PropertyVisitor_VisitingAnEmptyStruct_DoesNotAllocate()
            {
                var container = new EmptyStruct();
                var visitor   = new CountVisitor();

                GCAllocTest.Method(() =>
                {
                    visitor.Count = 0;
                    PropertyContainer.Visit(ref container, visitor);
                })
                .ExpectedCount(0)
                .Warmup()
                .Run();

                Assert.That(visitor.Count, Is.EqualTo(0));
            }
예제 #7
0
        public unsafe void Write(string eventName, EventSourceOptions options)
        {
            if (eventName == null)
            {
                throw new ArgumentNullException("eventName");
            }

            Contract.EndContractBlock();

            if (!this.IsEnabled())
            {
                return;
            }

            var data = new EmptyStruct();

            this.WriteImpl(eventName, ref options, ref data, null, null);
        }
        protected override void RecordMessageInternal(
            string eventName,
            Guid activityId,
            Guid parentActivityId,
            EventLevel level,
            Keywords keywords,
            EventOpcode opcode,
            string jsonPayload)
        {
            EventSourceOptions options = this.CreateOptions(level, keywords, opcode);

            EventSource.SetCurrentThreadActivityId(activityId);

            if (jsonPayload != null)
            {
                JsonPayload payload = new JsonPayload(jsonPayload);
                this.eventSource.Write(eventName, ref options, ref activityId, ref parentActivityId, ref payload);
            }
            else
            {
                EmptyStruct payload = new EmptyStruct();
                this.eventSource.Write(eventName, ref options, ref activityId, ref parentActivityId, ref payload);
            }
        }
예제 #9
0
 public static EmptyStruct LdElemMustThrowExceptionIfIndexIsNegative(int i)
 {
     var array = new EmptyStruct[3];
     return array[i];
 }
예제 #10
0
 public static int test2(ref EmptyStruct foo)
 {
     return(foo.value + 20);
 }
예제 #11
0
 public static extern int mono_test_empty_struct(int a, EmptyStruct es, int b);
예제 #12
0
	public static int test2 (ref EmptyStruct foo) {
		return foo.value + 20;
	}
        // Token: 0x06003508 RID: 13576 RVA: 0x000CDCF8 File Offset: 0x000CBEF8
        public void Stop <T>(string eventName)
        {
            EmptyStruct emptyStruct = default(EmptyStruct);

            this.Stop <EmptyStruct>(eventName, ref emptyStruct);
        }
예제 #14
0
 public virtual void Add(T item)
 {
     //if (!dict.ContainsKey(item)) dict.Add(item, null);
     dict[item] = new EmptyStruct();
 }
예제 #15
0
 public static extern int mono_test_empty_struct(int a, EmptyStruct es, int b);
예제 #16
0
        /// <summary>
        /// Writes a trivial event associated with this activity.
        /// May only be called when the activity is in the Started state.
        /// </summary>
        /// <param name="eventName">
        /// The name to use for the event. Must not be null.
        /// </param>
        /// <param name="options">
        /// The options to use for the event.
        /// </param>
        public void Write(string?eventName, EventSourceOptions options)
        {
            var data = new EmptyStruct();

            this.Write(this.eventSource, eventName, ref options, ref data);
        }
예제 #17
0
 public static bool Compare(EmptyStruct?val, EmptyStruct val1)
 {
     return(val == null ? false : Compare(val.Value, val1));
 }
예제 #18
0
 public static bool Compare(EmptyStruct val, EmptyStruct val1)
 {
     return(val.Equals(val1));
 }
예제 #19
0
        public void Stop <T>(string eventName)
        {
            EmptyStruct data = new EmptyStruct();

            this.Stop <EmptyStruct>(eventName, ref data);
        }
예제 #20
0
    public static int test_0_marshal_empty_struct()
    {
        EmptyStruct es = new EmptyStruct ();

        if (mono_test_empty_struct (1, es, 2) != 0)
            return 1;

        return 0;
    }
        // Token: 0x0600350C RID: 13580 RVA: 0x000CDD5C File Offset: 0x000CBF5C
        public void Write(string eventName, EventSourceOptions options)
        {
            EmptyStruct emptyStruct = default(EmptyStruct);

            this.Write <EmptyStruct>(this.eventSource, eventName, ref options, ref emptyStruct);
        }
예제 #22
0
        /// <summary>
        /// Shortcut version see Start(string eventName, EventSourceOptions options, T data).  Data payload is empty.
        /// </summary>
        public EventSourceActivity Start(string?eventName, EventSourceOptions options)
        {
            var data = new EmptyStruct();

            return(this.Start(eventName, ref options, ref data));
        }
예제 #23
0
 public void Add(Task task)
 {
     _tasks[task] = new EmptyStruct();
     Interlocked.Increment(ref _count);
     task.ContinueWith(Remove);
 }
예제 #24
0
        /// <summary>
        /// Used if you wish to use the non-default stop name (which is the start name with Start replace with 'Stop')
        /// This can be useful to indicate unusual ways of stopping (but it is still STRONGLY recommended that
        /// you start with the same prefix used for the start event and you end with the 'Stop' suffix.
        /// </summary>
        public void Stop <T>(string?eventName)
        {
            var data = new EmptyStruct();

            this.Stop(eventName, ref data);
        }
        /// <summary>
        /// Writes a trivial event associated with this activity.
        /// May only be called when the activity is in the Started state.
        /// </summary>
        /// <param name="eventName">
        /// The name to use for the event. Must not be null.
        /// </param>
        /// <param name="options">
        /// The options to use for the event.
        /// </param>
        public void Write(string?eventName, EventSourceOptions options)
        {
            EmptyStruct data = default;

            this.Write(this.eventSource, eventName, ref options, ref data);
        }
예제 #26
0
    public static void StaticMethodWithLocalEmptyStruct()
    {
        var es = new EmptyStruct();

        Console.WriteLine($"break here");
    }
        // Token: 0x06003505 RID: 13573 RVA: 0x000CDCAC File Offset: 0x000CBEAC
        public EventSourceActivity Start(string eventName, EventSourceOptions options)
        {
            EmptyStruct emptyStruct = default(EmptyStruct);

            return(this.Start <EmptyStruct>(eventName, ref options, ref emptyStruct));
        }
예제 #28
0
 public static EmptyStruct Create(EmptyStruct val)
 {
     return(new EmptyStruct());
 }
예제 #29
0
 public virtual void Add(T item)
 {
     dict[item] = new EmptyStruct();
 }
예제 #30
0
 public static bool Compare(EmptyStruct?val, EmptyStruct val1)
 {
     return(Compare(val.Value, val1));
 }
        /// <summary>
        /// Shortcut version see Start(string eventName, EventSourceOptions options, T data).  Data payload is empty.
        /// </summary>
        public EventSourceActivity Start(string?eventName, EventSourceOptions options)
        {
            EmptyStruct data = default;

            return(this.Start(eventName, ref options, ref data));
        }
        /// <summary>
        /// Used if you wish to use the non-default stop name (which is the start name with Start replace with 'Stop')
        /// This can be useful to indicate unusual ways of stopping (but it is still STRONGLY recommended that
        /// you start with the same prefix used for the start event and you end with the 'Stop' suffix.
        /// </summary>
        public void Stop <T>(string?eventName)
        {
            EmptyStruct data = default;

            this.Stop(eventName, ref data);
        }
예제 #33
0
 public void RegisterAgent(string agentId)
 {
     Agents[agentId] = new EmptyStruct();
 }