
Problema con System.Diagnostics.Contracts
Publicado por Nuria (1 intervención) el 24/04/2016 21:51:49
Buenas, soy nueva en el foro y querría saber si me podríais ayudar con un problemita que tengo.
Estoy realizando un proyecto con un brazalete llamado MyoArmband, el cual mediante sensores reconoce el movimiento de los músculos. Este brazalete permite su programación en C#, pero en una de las clases, la librería System.Diagnostics.Contracts me produce el siguiente fallo:
"Assets/Communication/RouteMyoEventArgs.cs(3,26): error CS0234: The type or namespace name `Contracts' does not exist in the namespace `System.Diagnostics'. Are you missing an assembly reference?"
He intentado importar la librería pero me dice que ya ha sido importada... y no tengo ni idea ya de que puede ser.
Os dejo aquí el contenido de la clase completa:
Muchas gracias de antemano!
Estoy realizando un proyecto con un brazalete llamado MyoArmband, el cual mediante sensores reconoce el movimiento de los músculos. Este brazalete permite su programación en C#, pero en una de las clases, la librería System.Diagnostics.Contracts me produce el siguiente fallo:
"Assets/Communication/RouteMyoEventArgs.cs(3,26): error CS0234: The type or namespace name `Contracts' does not exist in the namespace `System.Diagnostics'. Are you missing an assembly reference?"
He intentado importar la librería pero me dice que ya ha sido importada... y no tengo ni idea ya de que puede ser.
Os dejo aquí el contenido de la clase completa:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Text;
using MyoSharp.Device;
namespace MyoSharp.Communication{
/// <summary>
/// A class that contains information about an event for routing Myo events.
/// </summary>
public class RouteMyoEventArgs : EventArgs{
#region Fields
private readonly IntPtr _myoHandle;
private readonly IntPtr _eventHandle;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="RouteMyoEventArgs"/> class.
/// </summary>
/// <param name="myoHandle">The Myo handle.</param>
/// <param name="evt">The event handle.</param>
/// <param name="eventType">The type of the event.</param>
/// <param name="timestamp">The timestamp of the event.</param>
/// <exception cref="ArgumentException">
/// The exception that is thrown when <paramref name="myoHandle"/> or <paramref name="evt"/> are <see cref="IntPtr.Zero"/>.
/// </exception>
public RouteMyoEventArgs(IntPtr myoHandle, IntPtr evt, MyoEventType eventType, DateTime timestamp){
Contract.Requires<ArgumentException>(myoHandle != IntPtr.Zero, "myoHandle");
Contract.Requires<ArgumentException>(evt != IntPtr.Zero, "evt");
_myoHandle = myoHandle;
_eventHandle = evt;
this.EventType = eventType;
this.Timestamp = timestamp;
}
#endregion
#region Properties
/// <summary>
/// Gets the Myo handle.
/// </summary>
public IntPtr MyoHandle{
get{
Contract.Ensures(Contract.Result<IntPtr>() != IntPtr.Zero);
return _myoHandle;
}
}
/// <summary>
/// Gets the event handle.
/// </summary>
public IntPtr Event{
get{
Contract.Ensures(Contract.Result<IntPtr>() != IntPtr.Zero);
return _eventHandle;
}
}
/// <summary>
/// Gets the type of the event.
/// </summary>
public MyoEventType EventType { get; private set; }
/// <summary>
/// Gets the timestamp of the event.
/// </summary>
public DateTime Timestamp { get; private set; }
#endregion
#region Methods
[ContractInvariantMethod]
private void ObjectInvariant()
{
Contract.Invariant(_myoHandle != IntPtr.Zero);
Contract.Invariant(_eventHandle != IntPtr.Zero);
}
#endregion
}
}
Muchas gracias de antemano!
Valora esta pregunta


0