Method not found: 'System.DateTimeOffset System.DateTimeOffset.FromUnixTimeSeconds(Int64)'.
Hi and thanks for your nice API MrRR.
first i commented on the commit (e7f6c53) then i decided to bring up it here also.
so base on this: http://stackoverflow.com/questions/35178178/mono-missingmethodexception-datetimeoffset-fromunixtimeseconds-not-found/37694435#37694435 which i answered to the asker, this exception occure sometimes, or even for .net 4.5.1 and 4.5 Asp.NET Visual Studio Prjs.
that related to the lines 66-70 of src/Telegram.Bot/Converters/UnixDatetimeConverter.cs:
#if NET45
return ticks.FromUnixTime();
#else
return DateTimeOffset.FromUnixTimeSeconds(ticks).DateTime;
#endif
and the exception is kind of AggregateException and for the full stacktrace you can see the mentioned link in StackOverflow.
sorry but just for a suggestion i think it`s better you do that like this:
#if NET46
return DateTimeOffset.FromUnixTimeSeconds(ticks).DateTime;
#else
return ticks.FromUnixTime();
#endif
or even might you can use some conditionals DefineConstants in PropertyGroup of .prj file (as you know in this way you can say if .net version is lower than 4.6 do A and otherwise do B) coz in this way the code just work around seperating .net 4.5 or 4.6, but sure exist alot other versions also in the past, and also in future so with a lower than condition it would work for all time.
at last again Sorry for commenting both place (in commits and issues) and thanks a lot for providing this API.
with best regards, DANTE
Hi,
in commit 77d3cab494835fcac0546ef3a23ad5f789f7cbb2 i've done exactly this, but with inverted #IF. I'll upload a new beta containing this in a few minutes
Hi MrRoundRobin, It`s Strange, but after the changes exception still occur. why? Did you applied the changes on its NuGet pack?
can you tell more about your environment? NuGet Package Version, Project type etc.
Sure why not
IDE and PRJ:
- Visual Studio 2013 Ultimate Update 5.
- .NET Framwork Version 4.5.51650
- It`s a Class library project
Packages:
Json.NET
- Created by: James Newton-King
- Version 8.0.3
Microsoft ASP.NET Web API 2.2 Client Library
- Created by: Microsoft.AspNet.WebApi.Client
- Version: 5.2.3
Telegram Bot API
- Created by: Robin Muller
- Version: 9.0.0
and, I using from this CL Project through an ASP.NET Website.
Do you need any more information, or some photo, or codes?
With best regards, DANTE
can you try the latest beta 10.2.0-beta-1?
Oops you're right the latest is 10.2 ...... Update: Fixed it and installed right now, going to test it and would tell you back about the result.
Thanks bro it`s correct and work well now, actually surely should had corrected even before i checked and sent message but, I wrongly used version 9.0.0 instead of last beta version.