See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: Revit 2016 C# plugin, Revit crashes if started through debugging from visual studio 2013

  1. #1
    Login to Give a bone
    0

    Default Revit 2016 C# plugin, Revit crashes if started through debugging from visual studio 2013

    I have a Revit 2016 plugin written in C# using visual studio Professional 2013 on a 64 bit windows 7 machine. I've been debugging it by starting the debug process in visual studio which in turn calls Revit with a command line argument to start a small project that I use for developing the plugin.
    Now for some reason Revit crashes during startup if I try to debug it like this, instead I found out that I can start Revit separately and then in visual studio use debug/attach to process... While I'm happy that I found a workaround it adds unnecessary overhead to an already tedious process (having to restart Revit everytime I wan't to start a new debug session). Separate question here: is there a way to tell Revit to "release" the plugin files and later reload them so that I don't have to close Revit, compile the plugins and then start Revit again?

    The debug output when it crashes can be seen in the attached file, the first error seems to be
    Code:
    A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
    After some googling the most common cause for this seems to be that the project is compiled for the wrong platform. This doesn't help me since I haven't changed the target platform, it has always been the default "Any CPU" and it has been working. I have however tried to change this setting to x64 (and x86) but it doesn't solve the problem.
    If I debug with "Enable native code debugging" ticked that line is preceeded by the following which I honestly doesn't understand anything from.
    Code:
    First-chance exception at 0x000007fefd4dadcd (KernelBase.dll) in Revit.exe: Microsoft C++ exception: EEFileLoadException * __ptr64 at memory location 0x0012ad48.
    First-chance exception at 0x000007fefd4dadcd (KernelBase.dll) in Revit.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
    First-chance exception at 0x000007fefd4dadcd (KernelBase.dll) in Revit.exe: Microsoft C++ exception: EEFileLoadException * __ptr64 at memory location 0x0012ad48.
    First-chance exception at 0x000007fefd4dadcd (KernelBase.dll) in Revit.exe: Microsoft C++ exception: EEFileLoadException * __ptr64 at memory location 0x0012ca00.
    First-chance exception at 0x000007fefd4dadcd (KernelBase.dll) in Revit.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
    First-chance exception at 0x000007fefd4dadcd (KernelBase.dll) in Revit.exe: Microsoft C++ exception: EEFileLoadException * __ptr64 at memory location 0x0012ca00.
    First-chance exception at 0x000007fefd4dadcd (KernelBase.dll) in Revit.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
    First-chance exception at 0x000007fefd4dadcd (KernelBase.dll) in Revit.exe: Microsoft C++ exception: EEFileLoadException * __ptr64 at memory location 0x0012ca00.
    I have version control of the project via SVN and have reverted to several different revisions to see if there is something in the code that I changed but no success.
    I have tried to repair the installations of both Revit and visual studio without any change in behavior.

    EDIT:
    It turned out that my workaround didn't work that great after all, I can't watch the value of any variables, the hint when I hover over them in the locals pane says that they might be optimized away which is not the case. So I've reverted to debugging by using printouts with Taskdialog.Show().. I'm getting closer and closer to my roots with small embedded systems were your only debugging option is to blink an LED
    Attached Files Attached Files
    Last edited by markstrom.martin717176; 2015-12-30 at 01:51 PM. Reason: update

  2. #2
    I could stop if I wanted to hugh.69031's Avatar
    Join Date
    2016-01
    Location
    Melbourne, Australia
    Posts
    360
    Login to Give a bone
    1

    Default Re: Revit 2016 C# plugin, Revit crashes if started through debugging from visual studio 2013

    This may help:

    http://thebuildingcoder.typepad.com/...ing-revit.html

    This blog has been of invaluable assistance in chasing gremlins from our add-in.

  3. #3
    Login to Give a bone
    0

    Default Re: Revit 2016 C# plugin, Revit crashes if started through debugging from visual studio 2013

    That looks very interesting, I'll give some of those methods a go once I'm clear of this mess

Similar Threads

  1. Visual Studio 2013 Communite Version X Autocad .net Wizards 2016
    By frankjanuba715924 in forum Dot Net API
    Replies: 16
    Last Post: 2015-12-22, 09:03 AM
  2. Visual Studio 2013 (Express)
    By peter in forum Bridging the Gap: LISP -> .NET -> LISP
    Replies: 6
    Last Post: 2014-01-14, 05:40 AM
  3. Visual Studio 2013 Preview Error
    By jluker in forum Dot Net API
    Replies: 1
    Last Post: 2013-09-26, 08:19 PM
  4. 2013: Revit 2013 not working after installing Visual Studio 2012!?
    By clog boy in forum Revit - API
    Replies: 3
    Last Post: 2012-12-13, 08:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •