Open surendernitj opened 3 years ago
Hi @surendernitj, how did you install storage sdk and cpprest sdk, via vcpkg or nuget?
Hi @surendernitj, how did you install storage sdk and cpprest sdk, via vcpkg or nuget?
I installled it via nuget package.
Hi @surendernitj, how did you install storage sdk and cpprest sdk, via vcpkg or nuget?
I installled it via nuget package.
Well, can you try 7.5.0.2 and see if this issue persists? 7.5.0 has a severe issue.
If this issues still exists in 7.5.0.2, can you share some code snippet that can reproduce this issue so that we can investigate?
I dont see 7.5.0.2 version in the release notes. I will try few older versions to see if it works. Sample code that breaks is:
utility::datetime time; utility::string_t s = time.to_string(utility::datetime::ISO_8601);
Its the same issue with 7.5.0.2 version. Its most probably related to casablanca and it seems its an issue with the min datetime.
utility::datetime time;
utility::string_t s = time.to_string(utility::datetime::ISO_8601);
The default constructor of utility::datetime
initializes it into uninitialized state. Converting such a datetime
to string would be undefined behavior.
Code here https://microsoft.github.io/cpprestsdk/asyncrt__utils_8h_source.html says that default constructor is:
datetime() : m_interval(0) { }
It this changed now? This code used to work fine but its breaking with the upgrade.
m_internal(0)
means an uninitialized state. You can search bool is_initialized() const
in the page.
let me ask you a question, what do you expect to get from that piece of code?
utility::datetime time;
utility::string_t s = time.to_string(utility::datetime::ISO_8601);
The product code it not just this piece of code. I shared it in very simplified form. With code similar to this we want to set the minimum filetime (1601-01-01T00:00:00Z). Actual code is something similar to:
entity_property Prop;
utility::datetime LeaseTime;
LeaseTime = LeaseTime + FILETIME_AS_ULONGLONG(ft); // ft is FILETIME which could be 0 (min filetime)
Prop.set_property_type(edm_type::datetime);
Prop.set_value( LeaseTime );
Could you please help me understand how i can set the minimum file time value for (1601-01-01T00:00:00Z) utility:datetime object.
I tried setting is by utility::datetime::from_string("1601-01-01T00:00:00Z") but it still fails when later on datetime is converted into string.
The issue here is 1601-01-01T00:00:00Z
is invalid. The minimum timestamp that can be represented with utility::datetime
is 100 nanoseconds after that.
Can you try utility::datetime::from_string("1601-01-01T00:00:01Z")
?
or something like utility::datetime::from_string("1601-01-01T00:00:00.0000001Z")
?
Nope, 1601-01-01T00:00:01Z does not work. I am using different base value 2000-01-01T00:00:00Z which works for me. Clearly its a breaking change.
It seems following change broke it https://github.com/microsoft/cpprestsdk/commit/f10d9f8e214516d2c19aa6ef831ee874a58c0479
and as per the test, bound conditions are // boundary cases: TestDateTimeRoundtrip(_XPLATSTR("1970-01-01T00:00:00Z")); // epoch TestDateTimeRoundtrip(_XPLATSTR("2038-01-19T03:14:06+00:00"), _XPLATSTR("2038-01-19T03:14:06Z")); // INT_MAX - 1
I upgraded from 5.2.0 to 7.5.0, build is green but utility::datetime.to_string() is breaking. Here is the stack
Program: c:\ut\TableMetadataStoreTests\TE.exe File: minkernel\crts\ucrt\src\appcrt\stdio\output.cpp Line: 273
Expression: ("Buffer too small", 0)
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.