none
Help program crashing RRS feed

  • Question

  • all the time when i open my program at my pc every thing ok and when i open at my friend pc its crashing with that messagebox : http://prntscr.com/lbg6uc

    this is the basic of what the program do : http://prntscr.com/lbh1zj

    its saying about somthing worng and some other stuff


    • Edited by Ahron321 Sunday, October 28, 2018 6:44 PM
    Sunday, October 28, 2018 4:14 PM

Answers

  • what?

    Don't worry, Ahron ... just ignore him.

    There is one problem with the code I posted previously, in this line:

    if (ex.InnerException != null && ex.InnerException.Message.IsNotNullOrEmpty())

    The problem is the .IsNotNullOrEmpty() because that is not a native C# method.  It's an Extension method I have for string variables. What the line should actually be with native C# code is:

    if (ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message) == false)


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    • Marked as answer by Ahron321 Thursday, November 8, 2018 9:11 PM
    Thursday, November 8, 2018 6:09 AM
    Moderator

All replies

  • Embed the image to your post using the image icon in the message toolbar. Don't use an external storage platfom, cause your post is otherwise incomplete, we cannot read it in one glance and much more, the external resource may get invalid..

    Sunday, October 28, 2018 4:45 PM
  • its just making a folder
    Sunday, October 28, 2018 4:50 PM
  • Show us some of your code …

    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Sunday, October 28, 2018 4:53 PM
    Moderator
  • this is the basic of what the program do : http://prntscr.com/lbh1zj

    • Edited by Ahron321 Sunday, October 28, 2018 5:37 PM
    Sunday, October 28, 2018 5:32 PM
  • Edit your original post and include the information there.

    I will not download things from obscure sources, and I guess, so won't others..


    Sunday, October 28, 2018 6:32 PM
  • all the time when i open my program at my pc every thing ok and when i open at my friend pc its crashing with that messagebox : http://prntscr.com/lbg6uc

    its saying about somthing worng and some other stuff


    It may be worth noting also that many of us in these forums can't read
    Hebrew. So if you have error messages in that (or any language other
    than English) it's your responsibility to translate into English.

    - Wayne


    • Edited by WayneAKing Monday, October 29, 2018 5:20 AM
    Sunday, October 28, 2018 11:08 PM
  • >> its crashing with that messagebox : http://prntscr.com/lbg6uc


    It may be worth noting also that many of us in these forums cam't read
    Hebrew. 

    For the benefit of those reluctant to go to unknown links to view images,
    and anyone who might wonder why I specifically mentioned Hebrew, this
    is the pic posted by the OP at the link provided:

    - Wayne

    Monday, October 29, 2018 3:15 AM
  • And, from Ahron's (the OP) other link a picture of the code he's using:

    So, Ahron, I see that you got at least some of that code from DerChris on another thread (where you asked the same question):

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/7e6741f7-bc9f-4671-905f-0e5eb20c67bb/file-copy-to-c?forum=csharpgeneral

    In that thread, DerChris has a class called FolderCopier. It seems that you hadn't been back to that thread since Tuesday, when you posted it and yet Chris has had several replies to you after that. You probably should have continued with that thread instead of starting a new one with the same question. I'm not going to Merge the threads yet (that seems to cause confusion in my opinion).

    So, Ahron, could you tell us, in English, what the error is and on what line it is occurring? And, is it happening in your code (above picture) or is it happening in the FolderCopier class that Chris wrote? If it *is* in the FolderCopier class, post the code that you used for that class (because it may be different than Chris's code).


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com


    Monday, October 29, 2018 5:03 AM
    Moderator
  • on what line i dont know cuz on my pc its working and on my friend pc its not working an this is says "somthing is worng that cannot support and if you will will press like keep going with out crashing.

    Monday, October 29, 2018 10:10 PM
  • Hi Ahron321,

    I would suggest that you could copy your application into your friend PC and debug your application. check what line of code causing the issue. and post the detailed error message on here. it will be beneficial to resolve the issue.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, October 30, 2018 1:28 AM
    Moderator
  • Hi Ahron,

    OK, so I think that your next step is to tackle this by wrapping up all that code you showed inside of a try/catch, and in the catch display the exception message in a MessageBox. So, it would look like this:

    try
    {
        if (Directory.Exists(@"W:\"))
        {
            if (Directory.Exists(drive.ToString() + @"\Windows App"))
            {
                FolderCopier.CopyFolder(drive.ToString() + @"\Windows App", @"W:\");
            }
            else
            {
                Directory.CreateDirectory(drive.ToString() + @"\Windows App");
            }
        }
        if (Directory.Exists(@"X:\"))
        {
            if (Directory.Exists(drive.ToString() + @"\Windows App"))
            {
                FolderCopier.CopyFolder(drive.ToString() + @"\Windows App", @"X:\");
            }
            else
            {
                Directory.CreateDirectory(drive.ToString() + @"\Windows App");
            }
        }
    }
    catch (Exception ex)
    {
        string ErrMsg = "Exception: " + ex.Message + Environment.NewLine;
        if (ex.InnerException != null && ex.InnerException.Message.IsNotNullOrEmpty())
            ErrMsg += "Inner Exception: " + ex.InnerException.Message + Environment.NewLine;
        // I suggest that you  include the .pdb file(s) for your friend's PC, so you can display the StackTrace
        ErrMsg += "StackTrace: " + ex.StackTrace;
        MessageBox.Show(ErrMsg)
    }
    


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Tuesday, October 30, 2018 4:56 AM
    Moderator
  • Got an error http://prntscr.com/lfkdoq
    Wednesday, November 7, 2018 6:03 PM
  • Embed the image to your post using the image icon in the message toolbar. Don't use an external storage platfom, cause your post is otherwise incomplete, we cannot read it in one glance and much more, the external resource may get invalid..
    Wednesday, November 7, 2018 6:33 PM
  • Wednesday, November 7, 2018 6:47 PM
  • @OP

    Are you saying that @bonnieb's code is rubbish# code? Are you?

    OK, then, you are correct!

    Yes, its code is rubbish# code.

    We all know that since a long long time.

    It is TROLLING this forum, with its rubbish# code and rubbish# concepts, since many years ago.

    It is very experienced, but not in programming; its experience is in ignoring programming concepts in general and pretend it knows programming... ROFL

    So, please, IGNORE its code and concepts.

    P.S.: I apologize for any inconvenience posted by the rubbish# coders around...

    Just for reference:

    Hi Ahron,

    OK, so I think that your next step is to tackle this by wrapping up all that code you showed inside of a try/catch, and in the catch display the exception message in a MessageBox. So, it would look like this:

    try
    {
    // ...
    } catch (Exception ex) { string ErrMsg = "Exception: " + ex.Message + Environment.NewLine; if (ex.InnerException != null && ex.InnerException.Message.IsNotNullOrEmpty()) ErrMsg += "Inner Exception: " + ex.InnerException.Message + Environment.NewLine; // I suggest that you include the .pdb file(s) for your friend's PC, so you can display the StackTrace ErrMsg += "StackTrace: " + ex.StackTrace; MessageBox.Show(ErrMsg) }


    ~~Bonnie DeWitt [ <strike>MVP </strike>]    



    • Edited by ritehere44 Wednesday, November 7, 2018 7:34 PM Just for reference...
    Wednesday, November 7, 2018 7:20 PM
  • what?
    Wednesday, November 7, 2018 7:31 PM
  • what?

    Don't worry, Ahron ... just ignore him.

    There is one problem with the code I posted previously, in this line:

    if (ex.InnerException != null && ex.InnerException.Message.IsNotNullOrEmpty())

    The problem is the .IsNotNullOrEmpty() because that is not a native C# method.  It's an Extension method I have for string variables. What the line should actually be with native C# code is:

    if (ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message) == false)


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    • Marked as answer by Ahron321 Thursday, November 8, 2018 9:11 PM
    Thursday, November 8, 2018 6:09 AM
    Moderator