Skip to content

Commit 8a480bc

Browse files
committed
Remove unneeded conditional compilation
1 parent 8f07d9c commit 8a480bc

28 files changed

+4
-281
lines changed

LibGit2Sharp/AmbiguousSpecificationException.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
using System;
2-
using System.Globalization;
3-
#if DESKTOP
42
using System.Runtime.Serialization;
5-
#endif
63

74
namespace LibGit2Sharp
85
{
96
/// <summary>
107
/// The exception that is thrown when the provided specification cannot uniquely identify a reference, an object or a path.
118
/// </summary>
12-
#if DESKTOP
139
[Serializable]
14-
#endif
1510
public class AmbiguousSpecificationException : LibGit2SharpException
1611
{
1712
/// <summary>
@@ -47,7 +42,6 @@ public AmbiguousSpecificationException(string message, Exception innerException)
4742
: base(message, innerException)
4843
{ }
4944

50-
#if DESKTOP
5145
/// <summary>
5246
/// Initializes a new instance of the <see cref="AmbiguousSpecificationException"/> class with a serialized data.
5347
/// </summary>
@@ -56,6 +50,5 @@ public AmbiguousSpecificationException(string message, Exception innerException)
5650
protected AmbiguousSpecificationException(SerializationInfo info, StreamingContext context)
5751
: base(info, context)
5852
{ }
59-
#endif
6053
}
6154
}

LibGit2Sharp/BareRepositoryException.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
2-
#if DESKTOP
32
using System.Runtime.Serialization;
4-
#endif
53
using LibGit2Sharp.Core;
64

75
namespace LibGit2Sharp
@@ -10,9 +8,7 @@ namespace LibGit2Sharp
108
/// The exception that is thrown when an operation which requires a
119
/// working directory is performed against a bare repository.
1210
/// </summary>
13-
#if DESKTOP
1411
[Serializable]
15-
#endif
1612
public class BareRepositoryException : LibGit2SharpException
1713
{
1814
/// <summary>
@@ -47,7 +43,6 @@ public BareRepositoryException(string message, Exception innerException)
4743
: base(message, innerException)
4844
{ }
4945

50-
#if DESKTOP
5146
/// <summary>
5247
/// Initializes a new instance of the <see cref="LibGit2Sharp.BareRepositoryException"/> class with a serialized data.
5348
/// </summary>
@@ -56,7 +51,6 @@ public BareRepositoryException(string message, Exception innerException)
5651
protected BareRepositoryException(SerializationInfo info, StreamingContext context)
5752
: base(info, context)
5853
{ }
59-
#endif
6054

6155
internal BareRepositoryException(string message, GitErrorCode code, GitErrorCategory category)
6256
: base(message, code, category)

LibGit2Sharp/BufferedStream.cs

Lines changed: 0 additions & 96 deletions
This file was deleted.

LibGit2Sharp/CheckoutConflictException.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
2-
#if DESKTOP
32
using System.Runtime.Serialization;
4-
#endif
53
using LibGit2Sharp.Core;
64

75
namespace LibGit2Sharp
@@ -11,9 +9,7 @@ namespace LibGit2Sharp
119
/// because of a conflicting change staged in the index, or unstaged
1210
/// in the working directory.
1311
/// </summary>
14-
#if DESKTOP
1512
[Serializable]
16-
#endif
1713
public class CheckoutConflictException : LibGit2SharpException
1814
{
1915
/// <summary>
@@ -48,7 +44,6 @@ public CheckoutConflictException(string message, Exception innerException)
4844
: base(message, innerException)
4945
{ }
5046

51-
#if DESKTOP
5247
/// <summary>
5348
/// Initializes a new instance of the <see cref="LibGit2Sharp.CheckoutConflictException"/> class with a serialized data.
5449
/// </summary>
@@ -61,6 +56,5 @@ protected CheckoutConflictException(SerializationInfo info, StreamingContext con
6156
internal CheckoutConflictException(string message, GitErrorCode code, GitErrorCategory category)
6257
: base(message, code, category)
6358
{ }
64-
#endif
6559
}
6660
}

LibGit2Sharp/Core/Handles/Libgit2Object.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,8 @@ internal unsafe Libgit2Object(void* handle, bool owned)
106106
#if LEAKS_TRACKING
107107
id = Guid.NewGuid();
108108
Trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "Allocating {0} handle ({1})", GetType().Name, id));
109-
#if DESKTOP
109+
110110
trace = new StackTrace(2, true).ToString();
111-
#else
112-
try
113-
{
114-
throw new Exception();
115-
}
116-
catch (Exception ex)
117-
{
118-
trace = new StackTrace(ex, true).ToString();
119-
}
120-
#endif
121111
#endif
122112
}
123113

LibGit2Sharp/Core/Proxy.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,12 +1603,7 @@ public static unsafe ObjectId git_odb_write(ObjectDatabaseHandle odb, byte[] dat
16031603
int res;
16041604
fixed(byte* p = data)
16051605
{
1606-
#if DESKTOP
1607-
UIntPtr len = new UIntPtr((ulong)data.LongLength);
1608-
#else
1609-
UIntPtr len = new UIntPtr((uint)data.Length);
1610-
#endif
1611-
res = NativeMethods.git_odb_write(out id, odb, p, len, type.ToGitObjectType());
1606+
res = NativeMethods.git_odb_write(out id, odb, p, new UIntPtr((ulong)data.LongLength), type.ToGitObjectType());
16121607
}
16131608
Ensure.ZeroResult(res);
16141609

LibGit2Sharp/EmptyCommitException.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
using System;
2-
#if DESKTOP
32
using System.Runtime.Serialization;
4-
#endif
53

64
namespace LibGit2Sharp
75
{
86
/// <summary>
97
/// The exception that is thrown when a commit would create an "empty"
108
/// commit that is treesame to its parent without an explicit override.
119
/// </summary>
12-
#if DESKTOP
1310
[Serializable]
14-
#endif
1511
public class EmptyCommitException : LibGit2SharpException
1612
{
1713
/// <summary>
@@ -46,7 +42,6 @@ public EmptyCommitException(string message, Exception innerException)
4642
: base(message, innerException)
4743
{ }
4844

49-
#if DESKTOP
5045
/// <summary>
5146
/// Initializes a new instance of the <see cref="EmptyCommitException"/> class with a serialized data.
5247
/// </summary>
@@ -55,6 +50,5 @@ public EmptyCommitException(string message, Exception innerException)
5550
protected EmptyCommitException(SerializationInfo info, StreamingContext context)
5651
: base(info, context)
5752
{ }
58-
#endif
5953
}
6054
}

LibGit2Sharp/EntryExistsException.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
using System;
2-
#if DESKTOP
32
using System.Runtime.Serialization;
4-
#endif
53
using LibGit2Sharp.Core;
64

75
namespace LibGit2Sharp
86
{
97
/// <summary>
108
/// The exception that is thrown attempting to create a resource that already exists.
119
/// </summary>
12-
#if DESKTOP
1310
[Serializable]
14-
#endif
1511
public class EntryExistsException : LibGit2SharpException
1612
{
1713
/// <summary>
@@ -46,7 +42,6 @@ public EntryExistsException(string message, Exception innerException)
4642
: base(message, innerException)
4743
{ }
4844

49-
#if DESKTOP
5045
/// <summary>
5146
/// Initializes a new instance of the <see cref="LibGit2Sharp.EntryExistsException"/> class with a serialized data.
5247
/// </summary>
@@ -55,7 +50,6 @@ public EntryExistsException(string message, Exception innerException)
5550
protected EntryExistsException(SerializationInfo info, StreamingContext context)
5651
: base(info, context)
5752
{ }
58-
#endif
5953

6054
internal EntryExistsException(string message, GitErrorCode code, GitErrorCategory category)
6155
: base(message, code, category)

LibGit2Sharp/ICustomMarshaler.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

LibGit2Sharp/InvalidSpecificationException.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
2-
#if DESKTOP
32
using System.Runtime.Serialization;
4-
#endif
53
using LibGit2Sharp.Core;
64

75
namespace LibGit2Sharp
@@ -12,9 +10,7 @@ namespace LibGit2Sharp
1210
/// if the spec refers to an object of an incorrect type (e.g. asking to
1311
/// create a branch from a blob, or peeling a blob to a commit).
1412
/// </summary>
15-
#if DESKTOP
1613
[Serializable]
17-
#endif
1814
public class InvalidSpecificationException : LibGit2SharpException
1915
{
2016
/// <summary>
@@ -49,7 +45,6 @@ public InvalidSpecificationException(string message, Exception innerException)
4945
: base(message, innerException)
5046
{ }
5147

52-
#if DESKTOP
5348
/// <summary>
5449
/// Initializes a new instance of the <see cref="InvalidSpecificationException"/> class with a serialized data.
5550
/// </summary>
@@ -58,7 +53,6 @@ public InvalidSpecificationException(string message, Exception innerException)
5853
protected InvalidSpecificationException(SerializationInfo info, StreamingContext context)
5954
: base(info, context)
6055
{ }
61-
#endif
6256

6357
internal InvalidSpecificationException(string message, GitErrorCode code, GitErrorCategory category)
6458
: base(message, code, category)

0 commit comments

Comments
 (0)