Skip to content

Commit 0bd4205

Browse files
ghuntleyglennawatson
authored andcommitted
Fix: change exceptions to have meaningful directions to documentation to help users. (#1616)
The ones that are used for different nuget packages to indicate to the user they need to add a nuget package to their project due to the lack of DI registration.
1 parent dfbafe9 commit 0bd4205

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

src/ReactiveUI/Platforms/netstandard2.0/PlatformRegistrations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class PlatformRegistrations : IWantsToRegisterStuff
1010
{
1111
public void Register(Action<Func<object>, Type> registerFunction)
1212
{
13-
throw new Exception("You are referencing the Portable version of ReactiveUI in an App. Reference the platform-specific version.");
13+
throw new Exception("You are referencing the Portable version of ReactiveUI in an App. Please change your reference to the specific version for your platform found here: https://reactiveui.net/docs/getting-started/installation/nuget-packages");
1414
}
1515
}
1616
}

src/ReactiveUI/Platforms/windows-common/RoutedViewHost.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public RoutedViewHost()
7676

7777
if (platform == null) {
7878
// NB: This used to be an error but WPF design mode can't read
79-
// good or do other stuff good.
80-
this.Log().Error("Couldn't find an IPlatformOperations. This should never happen, your dependency resolver is broken");
79+
// good or do other stuff good.
80+
this.Log().Error("Couldn't find an IPlatformOperations implementation. Please make sure you have installed the latest version of the ReactiveUI packages for your platform. See https://reactiveui.net/docs/getting-started/installation/nuget-packages for guidance.");
8181
} else {
8282
platformGetter = () => platform.GetOrientation();
8383
}

src/ReactiveUI/Platforms/windows-common/ViewModelViewHost.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

@@ -87,7 +87,7 @@ public ViewModelViewHost()
8787
if (platform == null) {
8888
// NB: This used to be an error but WPF design mode can't read
8989
// good or do other stuff good.
90-
this.Log().Error("Couldn't find an IPlatformOperations. This should never happen, your dependency resolver is broken");
90+
this.Log().Error("Couldn't find an IPlatformOperations implementation. Please make sure you have installed the latest version of the ReactiveUI packages for your platform. See https://reactiveui.net/docs/getting-started/installation/nuget-packages for guidance.");
9191
} else {
9292
platformGetter = () => platform.GetOrientation();
9393
}

src/ReactiveUI/ReactiveNotifyPropertyChangedMixin.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

@@ -173,8 +173,7 @@ static IObservable<IObservedChange<object, object>> notifyForProperty(object sen
173173
}
174174

175175
if (result == null) {
176-
throw new Exception(
177-
String.Format($"Couldn't find a ICreatesObservableForProperty for {sender.GetType()} property {propertyName}. This should never happen, your service locator is probably broken."));
176+
throw new Exception($"Could not find a ICreatesObservableForProperty for {sender.GetType()} property {propertyName}. This should never happen, your service locator is probably broken. Please make sure you have installed the latest version of the ReactiveUI packages for your platform. See https://reactiveui.net/docs/getting-started/installation/nuget-packages for guidance.");
178177
}
179178

180179
return result.GetNotificationForProperty(sender, expression, propertyName, beforeChange);

0 commit comments

Comments
 (0)