none
Debug mode vs Release mode in vs2010 .net 4.0 issue RRS feed

  • Question

  • Hi all,

    Currently i have encountered a very strange issue with working in vs2010 environment.

    I have a project written in vb.net which runs fine if i compile in debug mode. However it will crash at some point after running if i compile it in Release mode.

    I have double checked all the conditional debug code (#if debug) and they look correct. They are just needed to show some information while debugging.

    I also created 'devenv.exe.config' config file with contents:

    <?xml version ="1.0"?>
    <configuration>
        <runtime>       
            <loadFromRemoteSources enabled="true" />
        </runtime>
    </configuration>

    I have tried all suggestions that people posted on the internet but still no hope. Same dependencies and dlls are used for both builds.

    Below is what i get from the error Description:

    System.Exception: Critical Error, CBS must exit. ---> System.NullReferenceException: Object reference not set to an instance of an object.
       at DevExpress.XtraBars.BarItemLink.OnLinkClick()
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at CBS.Startup.SingleInstanceController.Run(String[] args) in C:\Projects\VS2010\CBS\CBS\Startup\SingleInstanceController.vb:line 138
       at CBS.Startup.StartUp.Start() in C:\Projects\VS2010\CBS\CBS\Startup\StartUp.vb:line 29
       --- End of inner exception stack trace ---

    Please tell me if you have any suggestions

     

     


    • Edited by douglasle Monday, October 31, 2011 8:16 AM
    Monday, October 31, 2011 7:43 AM

Answers

  • Run your application from outside of VS. When it crashes (or even before it does), attach VS debugger to the process, or take dump and look at the dump in VS.

    -Karel

    • Marked as answer by Paul Zhou Thursday, November 10, 2011 6:25 AM
    Tuesday, November 8, 2011 4:33 AM
    Moderator
  • You're in a Window, I'm wondering if the DevExpress thing is an ActiveX control (unmanaged code). Release-mode garbage collection is more agressive (if that's the right word) than debug, so perhaps there are no references remaining to it or its managed wrapper, something like that anyway.
    Phil Wilson
    • Marked as answer by Paul Zhou Thursday, November 10, 2011 6:25 AM
    Wednesday, November 9, 2011 9:58 PM
  • Hi,

    It seems that you are using some dependencies and dlls in the project. I suggest you remove all added referenced dlls and re-add them to check whether it works. If still failed to run, I suggest you create a new project to test with the references.

     


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Thursday, November 10, 2011 6:25 AM
    Tuesday, November 1, 2011 8:22 AM

All replies

  • Hi,

    It seems that you are using some dependencies and dlls in the project. I suggest you remove all added referenced dlls and re-add them to check whether it works. If still failed to run, I suggest you create a new project to test with the references.

     


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Thursday, November 10, 2011 6:25 AM
    Tuesday, November 1, 2011 8:22 AM
  • Can you post code for the method DevExpress.XtraBars.BarItemLink.OnLinkClick() ?

     


    Please mark this post as answer if it solved your problem. Happy Programming!
    Wednesday, November 2, 2011 6:02 AM
  • Run your application from outside of VS. When it crashes (or even before it does), attach VS debugger to the process, or take dump and look at the dump in VS.

    -Karel

    • Marked as answer by Paul Zhou Thursday, November 10, 2011 6:25 AM
    Tuesday, November 8, 2011 4:33 AM
    Moderator
  • You're in a Window, I'm wondering if the DevExpress thing is an ActiveX control (unmanaged code). Release-mode garbage collection is more agressive (if that's the right word) than debug, so perhaps there are no references remaining to it or its managed wrapper, something like that anyway.
    Phil Wilson
    • Marked as answer by Paul Zhou Thursday, November 10, 2011 6:25 AM
    Wednesday, November 9, 2011 9:58 PM