I have been having this issue for quite a while going back to PB 12.5 at least(although it seems more repeatable on 2017 R2) and thought I would see if any one has some insight.
Whenever I build my application with the project painter everything works fine - ie the app works fine- but the next time I try and run the application from the development environment, the application crashes immediately. It is almost as if some kind of application or pbl level information gets corrupted. If I create a new target and application pbl, import the code for the app and reassign the library list everything seems back to normal. Then when I build the next time it happens all over again. Does anyone have any ideas? Is there something I might investigate that is associated with the application or might get modified when a build is done?