I'm trying to create a Modern Experience page from a Provider Hosted app in C# and add webparts to it.
The ClientSidePage is created ok and i can add sections to it with ClientSidePage.AddSection(CanvasSectionTemplate.OneColumn, s.Section.Order)
The problem arises when i try to add webparts to the page. Nothing happens when i call ClientSidePage.AvailableClientSideComponents(). The same problem arises when calling ClientSidePage.InstantiateDefaultWebPart(DefaultClientSideWebParts.Events)
I get no error, the code just does not execute. After a while the code seems to timeout, still without an exception. I can navigate to the page and edit it. Now i see my sections but no webparts ofcourse.
Sometimes, maybe 1 out of 10 times, the code works and the webparts are added to the page.