Tag: c#
-
Error CS0029 Cannot implicitly convert type ‘System.Threading.Tasks.Task’ to ‘Type’
0 Getting the Error CS0029 Cannot implicitly convert type ‘System.Threading.Tasks.Task<peMove.Maui.Models.ErpPart>’ to ‘peMove.Maui.Models.ErpPart’. It can’t convert the ErpPart type to an ErpPart type?? This is probably fairly straight forward but new to C# (VB coder) and async operations. I have been struggling with a lot and am just not seeing it (or burnt out). MainPage.xmal.cs async…
-
How to get access to class IList members through GraphQL?
0 I have a simple Graphql query like this public class Query { public async Task<IPagedList<Book>> Books(int pageIndex, int pageSize) { var data = new List<Book>() { new() { Title = "C# in depth.", Author = new Author { Name = "Jon Skeet" } },new() { Title = "How to cook Phở", Author = new…
-
.NET8 supports Vector512, but why doesn’t Vector reach 512 bits?
7 My CPU is AMD Ryzen 7 7840H which supports AVX-512 instruction set. When I run the .NET8 program, the value of Vector512.IsHardwareAccelerated is true. But System.Numerics.Vector<T> is still 256-bit, and does not reach 512-bit. Why doesn’t the Vector<T> type reach 512 bits in length? Is it currently unsupported, or do I need to tweak…
-
Deadlocks whenever calling graphQLClient from Maui
0 I am really struggling to get any data returned from a GraphQL Query in Maui. I had the code in the initializer of the Page and was hitting Deadlocks. I get that now. So I have move the code to a button on a page. It is hanging on the line below the Task…
-
Why can adding a month to a valid date result in an invalid date instead of adjusting the result to be valid?
16 The <chrono> library allows dates to silently fall into a state of !ok(). For example: #include <chrono> #include <iostream> int main() { using namespace std; using namespace chrono; auto date = 2023y/October/31; cout << date.ok() << ‘n’; date += months{1}; cout << date.ok() << ‘n’; } Output: 1 0 Demo. I get that Oct…
-
When is it ok to be !ok() with C++20 chrono dates?
10 The <chrono> library allows dates to silently fall into a state of !ok(). For example: #include <chrono> #include <iostream> int main() { using namespace std; using namespace chrono; auto date = 2023y/October/31; cout << date.ok() << ‘n’; date += months{1}; cout << date.ok() << ‘n’; } Output: 1 0 Demo. I get that Oct…
-
fmt format %H:%M:%S without decimals
7 I am trying to format a std::chrono::duration object to the format HH:MM::SS, e.g. 16:42:02 being the hours (16), the minutes (42), and the seconds (2). the library fmt offers useful formatting specifiers for this: using namespace std::chrono; auto start = high_resolution_clock::now(); auto end = start + 4s; fmt::print("{:%H:%M:%S} n", end); which unfortuantely prints the…
-
Are enum values allowed in a std::integer_sequence?
14 This code compiles and executes fine using GCC 13 and Clang 17, but fails to compile on MSVC. I am wondering if the code is required to work according to the standard or if this is a problem with MSVC. Demo #include <utility> #include <iostream> enum e : int { A=5, B, C, D…
-
Is int &ref = ref; well formed
7 I have learned that evaluating an uninitialized variable is undefined behavior. In particular, int i = i; is undefined behavior. I have read What's the behavior of an uninitialized variable used as its own initializer? But, is using a reference variable to initialize itself also undefined behavior? In particular, is int &ref = ref;…
-
Mocking and unit testing graphql-dotnet
0 I’m using graphql-dotnet library to query some GraphQL APIs from my C# code. Is there a way to easily mock the GraphQLHttpClient in unit tests? c# unit-testing graphql moq graphql-dotnet Share Follow asked 1 hour ago Dawid RutkowskiDawid Rutkowski 2,66711 gold badge3030 silver badges3737 bronze badges 2 what did you try yourself? – MakePeaceGreatAgain 42…