I try to get report like this
var report = await ServiceClient.Reports.GetMailboxUsageStorage("D7").Request().GetAsync();
But it fails with
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: R. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Microsoft.Graph.Serializer.DeserializeObject[T](String inputString)
at Microsoft.Graph.ResponseHandler.HandleResponse[T](HttpResponseMessage response)
at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
What's wrong? Do you have any ideas?
Looks like there is an issue in the Microsoft Graph SDK, so you can use the HttpClient and get the data by using the following code.
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://graph.microsoft.com/v1.0/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
HttpResponseMessage response = await client.GetAsync("reports/getMailboxUsageStorage(period='D7')");
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
You could see the results as below.
Related
I've been working on this for the last 3 hours and haven't found a good resource or solution to this problem. I've followed the directions found in Microsoft's documentation to change my ASP.net Privatekey from a string to an int. Since then, I have been presented with the following error:
FormatException: Input string was not in a correct format.
The app will not load past this method in the program.cs class:
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
I have hit a roadblock and any help with this issue would be appreciated.
Asp.net Error Stack:
FormatException: Input string was not in a correct format.
System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
ArgumentException: 4c3ccce2-61cd-4315-9cf2-99933f6797ed is not a valid value for Int32. (Parameter 'value')
System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
Stack Query Cookies Headers Routing
FormatException: Input string was not in a correct format.
System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
int.Parse(string s, NumberStyles style, IFormatProvider provider)
System.ComponentModel.Int32Converter.FromString(string value, NumberFormatInfo formatInfo)
System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
Show raw exception details
System.FormatException: Input string was not in a correct format.
at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.ComponentModel.Int32Converter.FromString(String value, NumberFormatInfo formatInfo)
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
ArgumentException: 4c3ccce2-61cd-4315-9cf2-99933f6797ed is not a valid value for Int32. (Parameter 'value')
System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
System.ComponentModel.TypeConverter.ConvertFromInvariantString(string text)
Microsoft.AspNetCore.Identity.UserStoreBase<TUser, TKey, TUserClaim, TUserLogin, TUserToken>.ConvertIdFromString(string id)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore<TUser, TRole, TContext, TKey, TUserClaim, TUserRole, TUserLogin, TUserToken, TRoleClaim>.FindByIdAsync(string userId, CancellationToken cancellationToken)
Microsoft.AspNetCore.Identity.UserManager.FindByIdAsync(string userId)
Microsoft.AspNetCore.Identity.UserManager.GetUserAsync(ClaimsPrincipal principal)
Microsoft.AspNetCore.Identity.SignInManager.ValidateSecurityStampAsync(ClaimsPrincipal principal)
Microsoft.AspNetCore.Identity.SecurityStampValidator.ValidateAsync(CookieValidatePrincipalContext context)
Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleAuthenticateAsync()
Microsoft.AspNetCore.Authentication.AuthenticationHandler.AuthenticateAsync()
Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, string scheme)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Show raw exception details
System.ArgumentException: 4c3ccce2-61cd-4315-9cf2-99933f6797ed is not a valid value for Int32. (Parameter 'value')
---> System.FormatException: Input string was not in a correct format.
at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.ComponentModel.Int32Converter.FromString(String value, NumberFormatInfo formatInfo)
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
--- End of inner exception stack trace ---
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.ComponentModel.TypeConverter.ConvertFromInvariantString(String text)
at Microsoft.AspNetCore.Identity.UserStoreBase5.ConvertIdFromString(String id) at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore9.FindByIdAsync(String userId, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Identity.UserManager1.FindByIdAsync(String userId) at Microsoft.AspNetCore.Identity.UserManager1.GetUserAsync(ClaimsPrincipal principal)
at Microsoft.AspNetCore.Identity.SignInManager1.ValidateSecurityStampAsync(ClaimsPrincipal principal) at Microsoft.AspNetCore.Identity.SecurityStampValidator1.ValidateAsync(CookieValidatePrincipalContext context)
at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context
I think the problem may be that the login of your previous user may be completed when the ID is a string.
You now change it to int, so now it no longer knows what to do with the string.
I think the simplest solution is that you should delete the cookie, log out and log in again (use int instead).
I'm facing a weird issue in iOS 13.3 and 13.4 that having System.FormatException for some users only. The app is develop using Xamarin Forms.
The error happen after calling to backend API to get user profile but before reaching the backend API (verified not reaching because AppInsights trace logs is not showing the call).
I have check the places where the error might be happening but have no clue.
Exception Stack Trace recorded in AppCenter
System.FormatException: Input string was not in a correct format.
System.Text StringBuilder.FormatError ()
System.Text StringBuilder.AppendFormatHelper (System.IFormatProvider provider, System.String format, System.ParamsArray args)
System String.FormatHelper (System.IFormatProvider provider, System.String format, System.ParamsArray args)
System String.Format (System.String format, System.Object[] args)
Mobile.Services ApiService.GetAsync[T] (Wipro.MyBAT.Mobile.Core.Logging.AnalyticsEvent analyticsEvent, System.String endPoint, System.String queryString, System.Boolean requiresAuthentication, System.Threading.CancellationToken cancelToken, System.Boolean withRetry)
Mobile.Services ApiService.GetUserProfile ()
Mobile.Services.Users UserService.GetUserProfileFromServer ()
Get User Profile method
public async Task<Response<Common.Model.User>> GetUserProfile()
{
var result = await GetAsync<Response<Common.Model.User>>(AnalyticsEvent.UserProfilePerformance, Endpoints.PROFILE).ConfigureAwait(false);
return result;
}
Get User Profile method
private async Task<T> GetAsync<T>(AnalyticsEvent analyticsEvent, string endPoint, string queryString = "", bool requiresAuthentication = true, CancellationToken cancelToken = default, bool withRetry = true)
where T : new()
{
Stopwatch stopwatch = new Stopwatch();
var dict = new Dictionary<string, string>
{
{ "Throttler count", _throttler.CurrentCount.ToString() },
{ "Throttler limit", THROTTLER_LIMIT.ToString() },
{ "Retry", (!withRetry).ToString() }
};
await _throttler.WaitAsync();
stopwatch.Start();
string callId = System.Guid.NewGuid().ToString();
string url;
string responseString = string.Empty;
try
{
if (_connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.None || _connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.Unknown)
{
return default(T);
}
url = $"{_environment.HostUrl}/api/{endPoint}{queryString}";
HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, url);
if (requiresAuthentication)
{
var token = await _authService.GetAccessToken();
message.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", token);
message.Headers.Add("callid", callId);
}
// Error should be before this line as the call it not reaching API side
HttpResponseMessage response = await _httpClient.SendAsync(message, cancelToken);
Finally found the root cause of the problem. It is actually calling to the API server but is throwing exception before leaving mobile due to the user is having some VPN in the wifi network. Changing to use 4G instead of Wifi solve the problem.
The String.Format issue is due to the exception handling code using string.Format incorrectly. This makes the actual issue cover up by the string.format exception.
2 things learned:
Always check first if using another network solve the problem or not
Handle exception correctly
Not working Swagger Ui
500 : {"Message":"An error has occurred.","ExceptionMessage":"Invalid type owner for DynamicMethod.","ExceptionType":"System.ArgumentException","StackTrace":" at System.Reflection.Emit.DynamicMethod.Init(String name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] signature, Type owner, Module m, Boolean skipVisibility, Boolean transparentMethod, StackCrawlMark& stackMark)\r\n at System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility)\r\n at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes, Type owner)\r\n at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDefaultConstructor[T](Type type)\r\n at Newtonsoft.Json.Serialization.DefaultContractResolver.GetDefaultCreator(Type createdType)\r\n at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract(JsonContract contract)\r\n at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateArrayContract(Type objectType)\r\n at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)\r\n at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)\r\n at Swashbuckle.Swagger.SchemaRegistry.CreateInlineSchema(Type type)\r\n at Swashbuckle.Swagger.SchemaRegistry.GetOrRegister(Type type)\r\n at Swashbuckle.Swagger.SwaggerGenerator.CreateParameter(String location, ApiParameterDescription paramDesc, SchemaRegistry schemaRegistry)\r\n at Swashbuckle.Swagger.SwaggerGenerator.<>c__DisplayClass12.b__11(ApiParameterDescription paramDesc)\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at System.Collections.Generic.List1..ctor(IEnumerable1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)\r\n at Swashbuckle.Swagger.SwaggerGenerator.CreateOperation(ApiDescription apiDesc, SchemaRegistry schemaRegistry)\r\n at Swashbuckle.Swagger.SwaggerGenerator.CreatePathItem(IEnumerable1 apiDescriptions, SchemaRegistry schemaRegistry)\r\n at Swashbuckle.Swagger.SwaggerGenerator.<>c__DisplayClass7.<GetSwagger>b__4(IGrouping2 group)\r\n at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)\r\n at Swashbuckle.Swagger.SwaggerGenerator.GetSwagger(String rootUrl, String apiVersion)\r\n at Swashbuckle.Application.SwaggerDocsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Web.Http.HttpServer.d__0.MoveNext()"} http://localhost:5352/swagger/docs/v1
When I got this error, it was because I had an error/omission in my ResponseType definition (WebApi). The compiler was fine with it, but Swagger wasn't.
Failed
[ResponseType(typeof(IEnumerable<>))]
Worked
[ResponseType(typeof(IEnumerable<string>))]
I've had twitter login working on my site for years. I randomly decided to test it today and found out it was not working.
I am using dotnetopenauth 3.4.7.11121 . I have twitterConsumerKey and twitterConsumerSecret in my web config. Thoughts on where to troubleshoot first?
The error is "The remote server returned an error: (401) Unauthorized."
My code of note:
public static OutgoingWebResponse StartSignInWithTwitter(bool forceNewLogin)
{
var redirectParameters = new Dictionary<string, string>();
if (forceNewLogin)
{
redirectParameters["force_login"] = "true";
}
Uri callback = MessagingUtilities.GetRequestUrlFromContext().StripQueryArgumentsWithPrefix("oauth_");
var request = TwitterSignIn.PrepareRequestUserAuthorization(callback, null, redirectParameters);
return TwitterSignIn.Channel.PrepareResponse(request);
}
The exception:
[WebException: The remote server returned an error: (401) Unauthorized.]
System.Net.HttpWebRequest.GetResponse() +6442312
DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\Messaging\StandardWebRequestHandler.cs:126
[ProtocolException: Error occurred while sending a direct message or getting the response.]
DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\Messaging\StandardWebRequestHandler.cs:169
DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\Messaging\StandardWebRequestHandler.cs:100
DotNetOpenAuth.Messaging.Channel.GetDirectResponse(HttpWebRequest webRequest) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\Messaging\Channel.cs:622
DotNetOpenAuth.Messaging.Channel.RequestCore(IDirectedProtocolMessage request) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\Messaging\Channel.cs:644
DotNetOpenAuth.Messaging.Channel.Request(IDirectedProtocolMessage requestMessage) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\Messaging\Channel.cs:467
DotNetOpenAuth.Messaging.Channel.Request(IDirectedProtocolMessage requestMessage) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\Messaging\Channel.cs:447
DotNetOpenAuth.OAuth.ConsumerBase.PrepareRequestUserAuthorization(Uri callback, IDictionary`2 requestParameters, IDictionary`2 redirectParameters, String& requestToken) in c:\BuildAgent\work\a02b428f36957bca\src\DotNetOpenAuth\OAuth\ConsumerBase.cs:221
TwitterConsumer.StartSignInWithTwitter(Boolean forceNewLogin) in c:\TFSWebForms\www.nanaimo.ca\Nanaimo.Ca\openID\TwitterConsumer.cs:207
openID_login.ibTwitter_Click(Object sender, EventArgs e) in c:\TFSWebForms\www.nanaimo.ca\Nanaimo.Ca\openID\login.aspx.cs:717
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +116
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +101
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9643314
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
UPDATE
I used fiddler and found that that dotnetopenauth is not forwarding the authentication when it gets redirected from http to https.
I found my issue. Twitter seems to have started forcing https and the redirect stopped working. I updated my twitter consumer to change it to https from http. My consumer was taken from the samples.
/// <summary>
/// The description of Twitter's OAuth protocol URIs for use with actually reading/writing
/// a user's private Twitter data.
/// </summary>
public static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription
{
RequestTokenEndpoint = new MessageReceivingEndpoint("https://twitter.com/oauth/request_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
UserAuthorizationEndpoint = new MessageReceivingEndpoint("https://twitter.com/oauth/authorize", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
AccessTokenEndpoint = new MessageReceivingEndpoint("https://twitter.com/oauth/access_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
};
/// <summary>
/// The description of Twitter's OAuth protocol URIs for use with their "Sign in with Twitter" feature.
/// </summary>
public static readonly ServiceProviderDescription SignInWithTwitterServiceDescription = new ServiceProviderDescription
{
RequestTokenEndpoint = new MessageReceivingEndpoint("https://twitter.com/oauth/request_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
UserAuthorizationEndpoint = new MessageReceivingEndpoint("https://twitter.com/oauth/authenticate", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
AccessTokenEndpoint = new MessageReceivingEndpoint("https://twitter.com/oauth/access_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
};
Semi related: my old timeline URL "http://twitter.com/statuses/user_timeline/14529984.xml" changed to https://api.twitter.com/1/statuses/user_timeline/14529984.xml at some point breaking another feature of my app.
Total noob when it comes to using AIML and having a really hard time getting this set up for an asp.net mvc webpage. I have a basic view setup that the user can enter a message in a textbox and I'm trying to get the chatbot to return a response. I've gotten that interaction to work with my text case so I know the function is correctly getting the users response and that I can send back a response and show it in the chatbox, my problem is trying to setup the chatbot to create dynamic responses. Right now in my controller I have:
String filePath = Server.MapPath("~/aimlBot/aiml/");
ChatBot catbot = new ChatBot(filePath);
string ReturnText = catbot.GetOutput(text); //text is just a string no html or fancy stuff in it
and my ChatBot class
Public class ChatBot : Bot
{
private Bot myBot;
private User myUser;
public ChatBot(string filepath)
{
myBot = new Bot();
myUser = new User("Human", myBot);
Initialize(filepath);
}
private void Initialize(string filepath)
{
AIMLbot.Utils.AIMLLoader loader = new AIMLbot.Utils.AIMLLoader(this.myBot);
myBot.isAcceptingUserInput = false;
loader.loadAIML(filepath);
myBot.isAcceptingUserInput = true;
}
public String GetOutput(String input)
{
Request r = new Request(input, myUser, myBot);
Result res = myBot.Chat(r); //breaks here
string response = "Bot: " + res.Output;
return (response);
}
}
the problem I'm getting is at the
Result res = myBot.Chat(r);
the program throws a FormatException
System.FormatException was unhandled by user code
Message=Input string was not in a correct format.
Source=mscorlib
StackTrace:
at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Convert.ToDouble(String value)
at AIMLbot.Bot.get_TimeOut()
at AIMLbot.Utils.Node.evaluate(String path, SubQuery query, Request request, MatchState matchstate, StringBuilder wildcard)
at AIMLbot.Bot.Chat(Request request)
at Ira.aimlBot.ChatBot.GetOutput(String input) in C:\Users\Ira\Documents\Visual Studio 2010\Projects\Ira\Ira\aimlBot\ChatBot.cs:line 36
at Ira.Controllers.ARGController.Speak(String text) in C:\Users\Ira\Documents\Visual Studio 2010\Projects\Ira\Ira\Controllers\ARGController.cs:line 35
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
InnerException:
I have No idea what is wrong with my code. I've tried even changing it from the variable string to just a hardcode case like "Hello how are you" which still caused the same exception.
You have everything perfect except the loadSettings function. Please refer the below snippet to clear your problem!
public ChatBot(string filepath)
{
myBot = new Bot();
myBot.loadSettings(); // <----- You have to insert this line to fix the error!
myUser = new User("Human", myBot);
Initialize(filepath);
}