#Darkpsyche
1 messages ยท Page 1 of 1 (latest)
I got it @brisk mural
@alpine solar we're going to need a lot more details than this. Do you have Products in your account for example?
yes
can you share a concrete example?
and i got them with List(options) and a limit set
of what exactly?
like a concrete product id, exact code for both solutions, etc.
yep
are you from Stripe? that's the meaning of the S beside your name?
oh, admin. ok
correct though this is public, but a product id is not a big secret
prod_MmYShOAwCdOoDD
last inserted product, due to a test from console
no it's not a secret, but it would be useless to you :p
StripeList<Stripe.Product> products = ProductService.List(options);
this works
ProductService is a singleton that serves the service from stripe
foreach (var prod in ProductService.ListAutoPaging())
this does not enter the cycle
can you share real/full code instead of just a small bit?
how?
like this is not valid code. I'm asking you to share real code not a small extract. Like you must be creating the service, then you must have something clear in your foreach to print the content, etc. I'm asking for real end to end code to ensure we look at the same thing
the cycle itself is enough?
I don't know what that means
I'm trying to help you, please share some simple code reproducing the issue end to end so that I can help you
sorry I'm trying to test but I switched laptops and broke my .NET environment ๐ฆ
public static List<ProductItem> GetAllProducts()
{
List<ProductItem> list = new List<ProductItem>();
var prods = new Stripe.ProductService().ListAutoPaging();
int length = prods.Count();
foreach (var prod in prods)
{
List<PriceItem> priceItems = new List<PriceItem>();
ProductItem productItem = new ProductItem()
{
Id = prod.Id,
Name = prod.Name,
Description = prod.Description,
Prices = priceItems,
};
list.Add(productItem);
}
return list;
}
I'm in debugging mode on visual studio.
actually when an access is attempted on prods, the function exits.
I don't know how and why, but the execution of the code stops and the control return to the frontend (blazor).
I can't share the project.
np
I'm looking with a colleague, I'll be right back
yep
Limit = 7,
};
var service = new ProductService();
var products = service.List(options);
foreach(var prod in products)
{
Console.WriteLine(prod.Id);
}
var productsAutoPaging = new Stripe.ProductService().ListAutoPaging();
Console.WriteLine("Before the loop");
foreach (var prod in productsAutoPaging)
{
Console.WriteLine(prod.Id);
}
Console.WriteLine("After the loop");```
can you try ^
yes
Starting IIS Express ...
Successfully registered URL "http://localhost:1229/" for site "StripeConnector" application "/"
Successfully registered URL "https://localhost:44300/" for site "StripeConnector" application "/"
Registration completed for site "StripeConnector"
IIS Express is running.
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Users\*\source\repos\***\BlazorApp1
prod_MmYShOAwCdOoDD
prod_MmYSu59gsxAdYH
prod_MmYMW0v5O2QvZC
prod_MmYKlOTIFRAmQv
prod_MmYHPYSFyNbD4g
prod_MmYEeyiCrJqdia
prod_MlZaizInXTHl67
Before the loop
the blazor page is stuck.
not frozen, but clicks are useless.
i can change page, but not interact with this page.
hum I have no idea what that could be then I'm sorry
like it looks like a blazor bug maybe? Can you try as a simple/basic just .NET file that you run end to end with no UI/server?
is it stuck because it's iterating through every product on your account and it's just slow
going to try with a simple app console
yeah unfortunately I need to run so you'll have to work with our support team directly otherwise: https://support.stripe.com/contact/email I'm sorry
works
ah neat
so I think you likely misunderstood
the code you had would loop through every products on your account
if you have thousands it will take quite a while to list them 10 at a time
and so your code was "blocking" to run through the entire list I assume
weird
what i can't understand is how the code stops being executed
try
{
Console.WriteLine("Before the loop");
foreach (var prod in productsAutoPaging)
{
Console.WriteLine(prod.Id);
}
Console.WriteLine("After the loop");
} catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
nothing
prod_MmYShOAwCdOoDD
prod_MmYSu59gsxAdYH
prod_MmYMW0v5O2QvZC
prod_MmYKlOTIFRAmQv
prod_MmYHPYSFyNbD4g
prod_MmYEeyiCrJqdia
prod_MlZaizInXTHl67
Before the loop
yeah i got nother here to advise and I really need to run sorry.
np, good work ๐
thanks, good luck, I hope you figure it out, if you're still stuck my team will be back on Monday here, just not here on the week end