Skip to content

Commit fb60d23

Browse files
authored
chore(Warnings): cleaning up some warnings for .NET 4.6 build (microsoft#851)
1 parent 99624a7 commit fb60d23

File tree

5 files changed

+24
-35
lines changed

5 files changed

+24
-35
lines changed

ReactWindows/ReactNative.Shared/Bridge/JavaScriptBundleLoader.cs

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,28 +88,24 @@ public override string SourceUrl
8888
get;
8989
}
9090

91+
#if WINDOWS_UWP
9192
public override async Task InitializeAsync()
9293
{
93-
try
94-
{
95-
#if WINDOWS_UWP
96-
var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(SourceUrl)).AsTask().ConfigureAwait(false);
97-
_script = storageFile.Path;
94+
var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(SourceUrl)).AsTask().ConfigureAwait(false);
95+
_script = storageFile.Path;
96+
}
9897
#else
99-
var assembly = Assembly.GetAssembly(typeof(JavaScriptBundleLoader));
100-
var assemblyName = assembly.GetName();
101-
var pathToAssembly = Path.GetDirectoryName(assemblyName.CodeBase);
102-
var pathToAssemblyResource = Path.Combine(pathToAssembly, SourceUrl.Replace("ms-appx:///", String.Empty));
103-
var u = new Uri(pathToAssemblyResource);
104-
_script = u.LocalPath;
105-
#endif
106-
}
107-
catch (Exception ex)
108-
{
109-
var exceptionMessage = Invariant($"File read exception for asset '{SourceUrl}'.");
110-
throw new InvalidOperationException(exceptionMessage, ex);
111-
}
98+
public override Task InitializeAsync()
99+
{
100+
var assembly = Assembly.GetAssembly(typeof(JavaScriptBundleLoader));
101+
var assemblyName = assembly.GetName();
102+
var pathToAssembly = Path.GetDirectoryName(assemblyName.CodeBase);
103+
var pathToAssemblyResource = Path.Combine(pathToAssembly, SourceUrl.Replace("ms-appx:///", String.Empty));
104+
var u = new Uri(pathToAssemblyResource);
105+
_script = u.LocalPath;
106+
return Task.CompletedTask;
112107
}
108+
#endif
113109

114110
public override void LoadScript(IReactBridge bridge)
115111
{
@@ -140,17 +136,9 @@ public CachedJavaScriptBundleLoader(string sourceUrl, string cachedFileLocation)
140136

141137
public override async Task InitializeAsync()
142138
{
143-
try
144-
{
145-
var localFolder = FileSystem.Current.LocalStorage;
146-
var storageFile = await localFolder.GetFileAsync(_cachedFileLocation).ConfigureAwait(false);
147-
_script = storageFile.Path;
148-
}
149-
catch (Exception ex)
150-
{
151-
var exceptionMessage = Invariant($"File read exception for asset '{SourceUrl}'.");
152-
throw new InvalidOperationException(exceptionMessage, ex);
153-
}
139+
var localFolder = FileSystem.Current.LocalStorage;
140+
var storageFile = await localFolder.GetFileAsync(_cachedFileLocation).ConfigureAwait(false);
141+
_script = storageFile.Path;
154142
}
155143

156144
public override void LoadScript(IReactBridge executor)

ReactWindows/ReactNative.Shared/DevSupport/DevInternalSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ private T GetSetting<T>(string key, T defaultValue)
137137
return (T)data;
138138
}
139139
}
140+
141+
return defaultValue;
140142
#else
141143
if (typeof(T) == typeof(bool))
142144
{
@@ -149,8 +151,6 @@ private T GetSetting<T>(string key, T defaultValue)
149151
throw new NotSupportedException(Invariant($"Configuration values of type '{typeof(T)}' are not supported."));
150152
}
151153
#endif
152-
153-
return defaultValue;
154154
}
155155

156156
private void SetSetting<T>(string key, T value)

ReactWindows/ReactNative.Shared/DevSupport/DevSupportManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ class DevSupportManager : IDevSupportManager, IDisposable
2626

2727
#if WINDOWS_UWP
2828
private readonly ShakeAccelerometer _accelerometer = ShakeAccelerometer.Instance;
29+
private bool _isShakeDetectorRegistered;
2930
#endif
31+
3032
private readonly SerialDisposable _pollingDisposable = new SerialDisposable();
3133

3234
private readonly IReactInstanceDevCommandsHandler _reactInstanceCommandsHandler;
@@ -36,7 +38,6 @@ class DevSupportManager : IDevSupportManager, IDisposable
3638
private readonly DevServerHelper _devServerHelper;
3739

3840
private bool _isDevSupportEnabled = true;
39-
private bool _isShakeDetectorRegistered;
4041

4142
private ReactContext _currentContext;
4243
private RedBoxDialog _redBoxDialog;

ReactWindows/ReactNative.Shared/UIManager/NativeViewHierarchyManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,10 @@ public void DispatchCommand(int reactTag, int commandId, JArray args)
537537
}
538538

539539
/// <summary>
540-
/// Shows a <see cref="PopupMenu"/>.
540+
/// Shows a popup menu.
541541
/// </summary>
542542
/// <param name="tag">
543-
/// The tag of the anchor view (the <see cref="PopupMenu"/> is
543+
/// The tag of the anchor view (the popup menu is
544544
/// displayed next to this view); this needs to be the tag of a native
545545
/// view (shadow views cannot be anchors).
546546
/// </param>

ReactWindows/ReactNative.Shared/UIManager/RootViewManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected override void AddEventEmitters(ThemedReactContext reactContext, SizeMo
4141
}
4242

4343
/// <summary>
44-
/// Creates a new view instance of type <see cref="Windows.UI.Xaml.Controls.Panel"/>.
44+
/// Creates a new view instance of type <see cref="SizeMonitoringCanvas"/>.
4545
/// </summary>
4646
/// <param name="reactContext">The React context.</param>
4747
/// <returns>The view instance.</returns>

0 commit comments

Comments
 (0)