Skip to content

Commit e9ba240

Browse files
committed
Reverted all C# 6 syntax sugar due to roslyn bug
dotnet/roslyn#4889
1 parent 57a0232 commit e9ba240

32 files changed

+116
-102
lines changed

Source/Extras/Extensions/ExceptionlessExtraConfigurationExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,20 @@ public static void ReadFromConfigSection(this ExceptionlessConfiguration config)
142142

143143
Type resolverInterface = types.FirstOrDefault(t => t.Name.Equals(resolver.Service) || t.FullName.Equals(resolver.Service));
144144
if (resolverInterface == null) {
145-
config.Resolver.GetLog().Error(typeof(ExceptionlessExtraConfigurationExtensions), $"An error occurred while retrieving service type \"{resolver.Service}\".");
145+
config.Resolver.GetLog().Error(typeof(ExceptionlessExtraConfigurationExtensions), String.Format("An error occurred while retrieving service type \"{0}\".", resolver.Service));
146146
continue;
147147
}
148148

149149
try {
150150
Type implementationType = Type.GetType(resolver.Type);
151151
if (!resolverInterface.IsAssignableFrom(implementationType)) {
152-
config.Resolver.GetLog().Error(typeof(ExceptionlessExtraConfigurationExtensions), $"Type \"{resolver.Type}\" does not implement \"{resolver.Service}\".");
152+
config.Resolver.GetLog().Error(typeof(ExceptionlessExtraConfigurationExtensions), String.Format("Type \"{0}\" does not implement \"{1}\".", resolver.Type, resolver.Service));
153153
continue;
154154
}
155155

156156
config.Resolver.Register(resolverInterface, implementationType);
157157
} catch (Exception ex) {
158-
config.Resolver.GetLog().Error(typeof(ExceptionlessExtraConfigurationExtensions), ex, $"An error occurred while registering service \"{resolver.Service}\" implementation \"{resolver.Type}\".");
158+
config.Resolver.GetLog().Error(typeof(ExceptionlessExtraConfigurationExtensions), ex, String.Format("An error occurred while registering service \"{0}\" implementation \"{1}\".", resolver.Service, resolver.Type));
159159
}
160160
}
161161
}

Source/Extras/Extensions/ToErrorModelExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private static bool ValueIsEmpty(object value) {
114114
};
115115

116116
private static string GetMessage(this Exception exception) {
117-
string defaultMessage = $"Exception of type '{exception.GetType().FullName}' was thrown.";
117+
string defaultMessage = String.Format("Exception of type '{0}' was thrown.", exception.GetType().FullName);
118118
string message = !String.IsNullOrEmpty(exception.Message) ? String.Join(" ", exception.Message.Split(new[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)).Trim() : null;
119119

120120
return !String.IsNullOrEmpty(message) ? message : defaultMessage;

Source/Extras/Logging/FileExceptionlessLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class FileExceptionlessLog : IExceptionlessLog, IDisposable {
1515

1616
public FileExceptionlessLog(string filePath, bool append = false) {
1717
if (String.IsNullOrEmpty(filePath))
18-
throw new ArgumentNullException(nameof(filePath));
18+
throw new ArgumentNullException("filePath");
1919

2020
FilePath = filePath;
2121
_append = append;

Source/Extras/Storage/FolderObjectStorage.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public FolderObjectStorage(IDependencyResolver resolver, string folder) {
3131

3232
public T GetObject<T>(string path) where T : class {
3333
if (String.IsNullOrWhiteSpace(path))
34-
throw new ArgumentNullException(nameof(path));
34+
throw new ArgumentNullException("path");
3535

3636
try {
3737
var json = File.ReadAllText(Path.Combine(Folder, path));
@@ -64,7 +64,7 @@ public bool Exists(string path) {
6464

6565
public bool SaveObject<T>(string path, T value) where T : class {
6666
if (String.IsNullOrWhiteSpace(path))
67-
throw new ArgumentNullException(nameof(path));
67+
throw new ArgumentNullException("path");
6868

6969
string directory = Path.GetDirectoryName(Path.Combine(Folder, path));
7070
if (!Directory.Exists(directory))
@@ -84,9 +84,9 @@ public bool SaveObject<T>(string path, T value) where T : class {
8484

8585
public bool RenameObject(string oldpath, string newpath) {
8686
if (String.IsNullOrWhiteSpace(oldpath))
87-
throw new ArgumentNullException(nameof(oldpath));
87+
throw new ArgumentNullException("oldpath");
8888
if (String.IsNullOrWhiteSpace(newpath))
89-
throw new ArgumentNullException(nameof(newpath));
89+
throw new ArgumentNullException("newpath");
9090

9191
try {
9292
lock (_lockObject) {
@@ -101,7 +101,7 @@ public bool RenameObject(string oldpath, string newpath) {
101101

102102
public bool DeleteObject(string path) {
103103
if (String.IsNullOrWhiteSpace(path))
104-
throw new ArgumentNullException(nameof(path));
104+
throw new ArgumentNullException("path");
105105

106106
try {
107107
File.Delete(Path.Combine(Folder, path));

Source/Extras/Storage/IsolatedStorageObjectStorage.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public bool Exists(string path) {
8989

9090
public T GetObject<T>(string path) where T : class {
9191
if (String.IsNullOrWhiteSpace(path))
92-
throw new ArgumentNullException(nameof(path));
92+
throw new ArgumentNullException("path");
9393

9494
try {
9595
var json = Run.WithRetries(() => {
@@ -115,7 +115,7 @@ public T GetObject<T>(string path) where T : class {
115115

116116
public bool SaveObject<T>(string path, T value) where T : class {
117117
if (String.IsNullOrWhiteSpace(path))
118-
throw new ArgumentNullException(nameof(path));
118+
throw new ArgumentNullException("path");
119119

120120
EnsureDirectory(path);
121121

@@ -150,9 +150,9 @@ public bool SaveObject<T>(string path, T value) where T : class {
150150

151151
public bool RenameObject(string oldpath, string newpath) {
152152
if (String.IsNullOrWhiteSpace(oldpath))
153-
throw new ArgumentNullException(nameof(oldpath));
153+
throw new ArgumentNullException("oldpath");
154154
if (String.IsNullOrWhiteSpace(newpath))
155-
throw new ArgumentNullException(nameof(newpath));
155+
throw new ArgumentNullException("newpath");
156156

157157
try {
158158
lock (_lockObject) {
@@ -170,7 +170,7 @@ public bool RenameObject(string oldpath, string newpath) {
170170

171171
public bool DeleteObject(string path) {
172172
if (String.IsNullOrWhiteSpace(path))
173-
throw new ArgumentNullException(nameof(path));
173+
throw new ArgumentNullException("path");
174174

175175
try {
176176
lock (_lockObject) {

Source/Extras/Submission/SubmissionClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public SubmissionResponse PostUserDescription(string referenceId, UserDescriptio
4747

4848
HttpWebResponse response;
4949
try {
50-
var request = CreateHttpWebRequest(config, $"events/by-ref/{referenceId}/user-description");
50+
var request = CreateHttpWebRequest(config, String.Format("events/by-ref/{0}/user-description", referenceId));
5151
response = request.PostJsonAsyncWithCompression(data).Result as HttpWebResponse;
5252
} catch (AggregateException aex) {
5353
var ex = aex.GetInnermostException() as WebException;
@@ -77,7 +77,7 @@ public SettingsResponse GetSettings(ExceptionlessConfiguration config, IJsonSeri
7777
}
7878

7979
if (response == null || response.StatusCode != HttpStatusCode.OK)
80-
return new SettingsResponse(false, message: $"Unable to retrieve configuration settings: {GetResponseMessage(response)}");
80+
return new SettingsResponse(false, message: String.Concat("Unable to retrieve configuration settings: ", GetResponseMessage(response)));
8181

8282
var json = response.GetResponseText();
8383
if (String.IsNullOrWhiteSpace(json))
@@ -127,7 +127,7 @@ private static void ConfigureServicePointManagerSettings() {
127127
ServicePointManager.Expect100Continue = false;
128128
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
129129
} catch (Exception ex) {
130-
Trace.WriteLine($"An error occurred while configuring SSL certificate validation. Exception: {ex}");
130+
Trace.WriteLine(String.Concat("An error occurred while configuring SSL certificate validation. Exception: ", ex));
131131
}
132132
}
133133
}

Source/Extras/Utility/AssemblyHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static List<Type> GetTypes(IExceptionlessLog log) {
3535

3636
types.AddRange(assembly.GetExportedTypes());
3737
} catch (Exception ex) {
38-
log.Error(typeof(ExceptionlessExtraConfigurationExtensions), ex, $"An error occurred while getting types for assembly \"{assembly}\".");
38+
log.Error(typeof(ExceptionlessExtraConfigurationExtensions), ex, String.Format("An error occurred while getting types for assembly \"{0}\".", assembly));
3939
}
4040
}
4141

Source/Extras/Utility/Run.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static void WithRetries(Action action, int attempts = 3, TimeSpan? retryI
1212

1313
public static T WithRetries<T>(Func<T> action, int attempts = 3, TimeSpan? retryInterval = null) {
1414
if (action == null)
15-
throw new ArgumentNullException(nameof(action));
15+
throw new ArgumentNullException("action");
1616

1717
if (!retryInterval.HasValue)
1818
retryInterval = TimeSpan.FromMilliseconds(new Random().Next(75, 125));

Source/Extras/Utility/SingleGlobalInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class SingleGlobalInstance : IDisposable {
1212
private static readonly ConcurrentDictionary<string, WaitHandle> _namedLocks = new ConcurrentDictionary<string, WaitHandle>();
1313

1414
private void InitWaitHandle() {
15-
string mutexId = $"Global\\{{{_key}}}";
15+
string mutexId = String.Format("Global\\{{{0}}}", _key);
1616

1717
try {
1818
var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow);

Source/Platforms/Web/RequestInfoCollector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static RequestInfo Collect(HttpContextBase context, ExceptionlessConfigur
5858
}
5959
} else if (context.Request.ContentLength > 0) {
6060
string value = Math.Round(context.Request.ContentLength / 1024m, 0).ToString("N0");
61-
info.PostData = $"Data is too large ({value}kb) to be included.";
61+
info.PostData = String.Format("Data is too large ({0}kb) to be included.", value);
6262
}
6363

6464
try {
@@ -88,7 +88,7 @@ private static Dictionary<string, string> ToDictionary(this HttpCookieCollection
8888
foreach (string key in cookies.AllKeys.Distinct().Where(k => !String.IsNullOrEmpty(k) && !k.AnyWildcardMatches(_ignoredCookies, true) && !k.AnyWildcardMatches(exclusions, true))) {
8989
try {
9090
HttpCookie cookie = cookies.Get(key);
91-
if (cookie?.Value != null && cookie.Value.Length < MAX_DATA_ITEM_LENGTH && !d.ContainsKey(key))
91+
if ( cookie != null && cookie.Value != null && cookie.Value.Length < MAX_DATA_ITEM_LENGTH && !d.ContainsKey(key))
9292
d.Add(key, cookie.Value);
9393
} catch (Exception ex) {
9494
if (!d.ContainsKey(key))

0 commit comments

Comments
 (0)