#Darkpsyche

1 messages ยท Page 1 of 1 (latest)

sharp frigateBOT
tawdry osprey
#

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?

alpine solar
#

yes

tawdry osprey
#

can you share a concrete example?

alpine solar
#

and i got them with List(options) and a limit set

alpine solar
tawdry osprey
#

like a concrete product id, exact code for both solutions, etc.

alpine solar
#

yep

#

are you from Stripe? that's the meaning of the S beside your name?

#

oh, admin. ok

tawdry osprey
#

correct though this is public, but a product id is not a big secret

alpine solar
#

prod_MmYShOAwCdOoDD

last inserted product, due to a test from console

alpine solar
#

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

tawdry osprey
#

can you share real/full code instead of just a small bit?

alpine solar
#

how?

tawdry osprey
#

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

alpine solar
#

the cycle itself is enough?

tawdry osprey
#

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

alpine solar
#

ok

#

'''C#'''

#

ops

tawdry osprey
#

sorry I'm trying to test but I switched laptops and broke my .NET environment ๐Ÿ˜ฆ

alpine solar
#
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.

tawdry osprey
#

I'm looking with a colleague, I'll be right back

alpine solar
#

yep

tawdry osprey
#
              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 ^

alpine solar
#

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.

tawdry osprey
#

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

alpine solar
#

going to try with a simple app console

tawdry osprey
alpine solar
tawdry osprey
#

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

alpine solar
#

in the console it takes only a second

#

< 100 prods

tawdry osprey
#

weird

alpine solar
#

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

tawdry osprey
#

yeah i got nother here to advise and I really need to run sorry.

alpine solar
tawdry osprey
#

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