rollbar / Rollbar.NET

Rollbar for .NET
https://docs.rollbar.com/docs/dotnet
MIT License
65 stars 44 forks source link

Invalid configuration file prototype error #408

Closed azuken closed 3 years ago

azuken commented 5 years ago

Describe the bug Since 3.2.0 version, which introduce configuration validation, my app cannot be started.

My code :

new RollbarConfig(ApiKeys.ROLLBAR_TOKEN);

To Reproduce Update from 3.1.0 to 3.2.0

Expected behavior Rollbar initialized and application launched.

Rollbar Client - Rollbar.NET Hosting Environment (please complete the following information):

azuken commented 5 years ago

It was ID passed in Person DTO, we set this parameter to string.Empty but it must be filled.

akornich commented 5 years ago

@azuken, I am glad it worked out well for you. We recommend a code pattern where you create and initialize a RollbarConfig object, call Validate() on it to make sure it returns an empty result (no validation rules violated), then, use the config instance to configure a logger.

azuken commented 5 years ago

Yes, it will be done. But it would be great if the error message was more explicit about what it missing. Thank you anyway

akornich commented 5 years ago

@azuken , how exactly did the error message look in your case? In general, we have enums for validation errors mentioning property name and what wrong with it...

azuken commented 5 years ago

I have just a stacktrace with error message "invalid configuration file provided". Maybe it's just because we didn't implemented Validate()function.

akornich commented 5 years ago

@azuken , were there any inner exceptions included with it? normally, in such a scenario, I would expect an inner exception providing actual hints on what exactly could be wrong with the config...

azuken commented 5 years ago

Here is the complete stacktrace :

2019-06-12 10:03:59.383831+0200 APPLICATION.iOS[91126:1243618] ConvertToNSExceptionAndAbort
2019-06-12 10:03:59.385323+0200 APPLICATION.iOS[91126:1243618] Inserted Xamarin Exception Stack Line!
2019-06-12 10:03:59.385494+0200 APPLICATION.iOS[91126:1243618] Name: System.Reflection.TargetInvocationException
2019-06-12 10:03:59.385723+0200 APPLICATION.iOS[91126:1243618] Message: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Rollbar.RollbarException: Failed to configure using invalid configuration prototype!Xamarin Exception Stack:
  at Rollbar.RollbarLogger.ValidateConfiguration (Rollbar.IRollbarConfig rollbarConfig) [0x0003b] in <c03d6a8e04c24793ac9ea412069c37d8>:0 
  at Rollbar.RollbarLogger.Configure (Rollbar.IRollbarConfig settings) [0x00000] in <c03d6a8e04c24793ac9ea412069c37d8>:0 
  at Rollbar.RollbarLogger.Rollbar.IRollbar.Configure (Rollbar.IRollbarConfig settings) [0x00000] in <c03d6a8e04c24793ac9ea412069c37d8>:0 
  at APPLICATION.iOS.Services.ErrorTrackingiOS.Configure (System.String username, System.String environment) [0x0006e] in /Users/XXXXX/APPLICATION.iOS/Services/ErrorTrackingiOS.cs:58 
  at APPLICATION.ViewModel.Login.LoginViewModel..ctor (APPLICATION.Service.Page.IPage page, APPLICATION.Service.Cache.Authentication.IAuthenticationCacheService authenticationCacheService, APPLICATION.Service.Authentication.IAuthenticationService authenticationService, APPLICATION.Service.Settings.ISettingsService settingsService, APPLICATION.Service.User.IUserService userService, APPLICATION.Service.Cache.Network.INetworkRequestCacheService networkRequestCacheService, APPLICATION.Service.Cache.ICacheManagerService cacheManagerService, APPLICATION.Service.UserMessage.IUserMessageManager userMessageManager, APPLICATION.Service.Metric.IMetricsManagerService metricsManagerService, APPLICATION.Toolkit.ErrorTracking.ICrashTracking crashTracking, APPLICATION.Toolkit.ErrorTracking.IErrorTracking errorTracking, APPLICATION.Service.Developer.IDeveloperModeManager developerModeManager, APPLICATION.Service.Dependency.IResolverService resolverService) [0x00074] in /Users/XXXXX/APPLICATION.ViewModel/Login/LoginViewModel.cs:68 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/MonoMethod.cs:698 
   --- End of inner exception stack trace ---
  at APPLICATION.Service.LocatorPage.get_NavigationLoginPage () [0x00069] in /Users/XXXXX/APPLICATION.Service/LocatorPage.cs:41 
  at APPLICATION.Core.BootStrapper.Run () [0x00001] in /Users/XXXXX/APPLICATION.Core/BootStrapper.cs:453 
  at APPLICATION.Core.APPLICATIONApp..ctor (Plugin.Toasts.IToastNotificator toastNotificator, APPLICATION.Service.UserMessage.Notification.IUserNotification userNotification, APPLICATION.Service.Feedback.IFeedbackService feedback, APPLICATION.Service.UserMessage.ApplicationBadge.IApplicationBadgeService applicationBadgeService, APPLICATION.Service.Print.IPrintService print, APPLICATION.Service.Mail.IMailService mail, APPLICATION.Toolkit.Environment.IEnvironment environment, APPLICATION.Toolkit.Network.IConnectivity connectivity, APPLICATION.Toolkit.ErrorTracking.ICrashTracking crashTracking, APPLICATION.Toolkit.ErrorTracking.IErrorTracking errorTracking, APPLICATION.Toolkit.IExceptionChecker exceptionChecker, APPLICATION.Service.Application.IApplicationStoreManager applicationStoreManager) [0x00039] in /Users/XXXXX/APPLICATION.Core/APPLICATIONApp.xaml.cs:39 
  at APPLICATION.iOS.AppDelegate.BuildApplication (APPLICATION.Toolkit.ErrorTracking.IErrorTracking errorTracking) [0x0004e] in /Users/XXXXX/APPLICATION.iOS/AppDelegate.cs:152 
  at APPLICATION.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication uiApplication, Foundation.NSDictionary launchOptions) [0x00113] in /Users/XXXXX/APPLICATION.iOS/AppDelegate.cs:94 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
2019-06-12 10:03:59.386632+0200 APPLICATION.iOS[91126:1243618] 
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:63 
  at APPLICATION.iOS.Application.Main (System.String[] args) [0x00001] in /Users/XXXXX/APPLICATION.iOS/Main.cs:12
2019-06-12 10:03:59.408587+0200 APPLICATION.iOS[91126:1243618] warning: exception inside UnhandledException handler: (null) assembly:/Users/XXXXX/Library/Developer/CoreSimulator/Devices/CA788DBC-AAEE-45B5-AF36-A3187840500A/data/Containers/Bundle/Application/450516C5-BE9E-4DCE-9029-CDD71ACBEB64/APPLICATION.iOS.app/Xamarin.iOS.dll type:MonoTouchException member:(null)
2019-06-12 10:03:59.409190+0200 APPLICATION.iOS[91126:1243618] Unhandled managed exception:
Exception has been thrown by the target of an invocation. (System.Reflection.TargetInvocationException)
  at APPLICATION.Service.LocatorPage.get_NavigationLoginPage () [0x00069] in /Users/XXXXX/APPLICATION.Service/LocatorPage.cs:41 
  at APPLICATION.Core.BootStrapper.Run () [0x00001] in /Users/XXXXX/APPLICATION.Core/BootStrapper.cs:453 
  at APPLICATION.Core.APPLICATIONApp..ctor (Plugin.Toasts.IToastNotificator toastNotificator, APPLICATION.Service.UserMessage.Notification.IUserNotification userNotification, APPLICATION.Service.Feedback.IFeedbackService feedback, APPLICATION.Service.UserMessage.ApplicationBadge.IApplicationBadgeService applicationBadgeService, APPLICATION.Service.Print.IPrintService print, APPLICATION.Service.Mail.IMailService mail, APPLICATION.Toolkit.Environment.IEnvironment environment, APPLICATION.Toolkit.Network.IConnectivity connectivity, APPLICATION.Toolkit.ErrorTracking.ICrashTracking crashTracking, APPLICATION.Toolkit.ErrorTracking.IErrorTracking errorTracking, APPLICATION.Toolkit.IExceptionChecker exceptionChecker, APPLICATION.Service.Application.IApplicationStoreManager applicationStoreManager) [0x00039] in /Users/XXXXX/APPLICATION.Core/APPLICATIONApp.xaml.cs:39 
  at APPLICATION.iOS.AppDelegate.BuildApplication (APPLICATION.Toolkit.ErrorTracking.IErrorTracking errorTracking) [0x0004e] in /Users/XXXXX/APPLICATION.iOS/AppDelegate.cs:152 
  at APPLICATION.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication uiApplication, Foundation.NSDictionary launchOptions) [0x00113] in /Users/XXXXX/APPLICATION.iOS/AppDelegate.cs:94 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:63 
  at APPLICATION.iOS.Application.Main (System.String[] args) [0x00001] in /Users/XXXXX/APPLICATION.iOS/Main.cs:12 
 --- inner exception ---
Failed to configure using invalid configuration prototype! (Rollbar.RollbarException)
  at Rollbar.RollbarLogger.ValidateConfiguration (Rollbar.IRollbarConfig rollbarConfig) [0x0003b] in <c03d6a8e04c24793ac9ea412069c37d8>:0 
  at Rollbar.RollbarLogger.Configure (Rollbar.IRollbarConfig settings) [0x00000] in <c03d6a8e04c24793ac9ea412069c37d8>:0 
  at Rollbar.RollbarLogger.Rollbar.IRollbar.Configure (Rollbar.IRollbarConfig settings) [0x00000] in <c03d6a8e04c24793ac9ea412069c37d8>:0 
  at APPLICATION.iOS.Services.ErrorTrackingiOS.Configure (System.String username, System.String environment) [0x0006e] in /Users/XXXXX/APPLICATION.iOS/Services/ErrorTrackingiOS.cs:58 
  at APPLICATION.ViewModel.Login.LoginViewModel..ctor (APPLICATION.Service.Page.IPage page, APPLICATION.Service.Cache.Authentication.IAuthenticationCacheService authenticationCacheService, APPLICATION.Service.Authentication.IAuthenticationService authenticationService, APPLICATION.Service.Settings.ISettingsService settingsService, APPLICATION.Service.User.IUserService userService, APPLICATION.Service.Cache.Network.INetworkRequestCacheService networkRequestCacheService, APPLICATION.Service.Cache.ICacheManagerService cacheManagerService, APPLICATION.Service.UserMessage.IUserMessageManager userMessageManager, APPLICATION.Service.Metric.IMetricsManagerService metricsManagerService, APPLICATION.Toolkit.ErrorTracking.ICrashTracking crashTracking, APPLICATION.Toolkit.ErrorTracking.IErrorTracking errorTracking, APPLICATION.Service.Developer.IDeveloperModeManager developerModeManager, APPLICATION.Service.Dependency.IResolverService resolverService) [0x00074] in /Users/XXXXX/APPLICATION.ViewModel/Login/LoginViewModel.cs:68 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/MonoMethod.cs:698
viraptor commented 3 years ago

I'd like to poke this issue again. The same exception is being thrown now with no explicit description of what went wrong. It would be great to get the name/description of the validation rule which failed first included in the exception.

akornich commented 3 years ago

@viraptor , what version of the SDK are you using? It looks like you are getting RollbarException. Look at its Data property for the failed rules. They should be listed within the Data dictionary...

viraptor commented 3 years ago

Latest available (4.0.3)

akornich commented 3 years ago

Thanks, see my reply above about Data property of the exception.

viraptor commented 3 years ago

To be clear, yes, I get the details in Data. I'm just noting I'm another person who ended up here by googling for the exception message. The comment was a feature request to append one of the violations to the exception message as a quality of life improvement.

akornich commented 3 years ago

How about I'll add a hint "See Data property of this exception for validation details." to the exception message?

viraptor commented 3 years ago

Sounds good to me :)