Loading Form crashing (Windows Form)
So im doing a pdf viewver using winform. I wanted to add a form that indicate the progression when loading the pdf pages. The problem is that the application crash during the for loop, and the loading form is not showing up before and its showing at the end of the loop but this is useless since the content is already loaded and it close immediately. I've tried many thing like using Task.Run but i cannot fix it. (pls help)
14 Replies
this is the loading form
the function where i use that class
Have you tried creating a super bare bones repro of the problem?
A WinForms crashing indicates an exception
Try catch the Convert method and see what exception pops up
wdym?
no i mean a little stop bc of the loop u see?
https://paste.gg/p/anonymous/4478c9c4e76f43e8b62dbffdec9fedfa
You might also need to call
BeginInvoke
on ResizeControls()
This is a CPU bound synchronous process
The Convert
method execution will finish before the loading completes so make sure you take care of thatCreating a seperate app with just enough libraries, etc. to reproduce the problem, which can make debugging a LOT easier / more simple. Also (and/or), you may want to add some logging to a local db or something in case the problem isn't something you can find via "stepping through the code."
Back in the day that was the first question most people trying to help you would ask. 😁
no but this is not rly the problem
ok i will try what you sent me
no...
wait
i can i post the project on github, install it on your machine and test it? You will have better understanding of what im trying to explain
@Nasdack go to Form1.cs and you will found the Convert function (it will take extracted image from pdf and add it to the form) btw you need to install Apose.PDF 1.8.4
https://github.com/Silme94/pdf
@Nasdack please
Did you try the code snippet I gave you?
@Silme94
yes
@Nasdack
and?
it dont work
bro try to get my code on my github and you will see
launch the app, go on "Ficher" after go on "Ouvrir" and open any pdf file
you will see
@Nasdack ?