MDA PInvoke Error

8 posts, 0 answers
  1. Daniel
    Daniel avatar
    21 posts
    Member since:
    Nov 2007

    Posted 11 Apr 2012 Link to this post

    Hello
    When I click on the cell of the GRID I got the following error from MDA

    A call to PInvoke function 'Telerik.WinControls.GridView!Telerik.WinControls.UI.RadGridViewAccessibleObject::NotifyWinEvent' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

    I am using the latest Q1 2012 SP1, in NET4.0

    Any ideas... I am completly blind in this one.

    ( I have already turn to x86 to compile)

  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 16 Apr 2012 Link to this post

    Hi Daniel,

    Thank you for writing.

    We are calling API method NotifyWinEvent (in order to push narrator to work) and its signature in C# is different from the signature in C++. For example, in C# long is 8 bytes, but in C++ it is 4 bytes. In short, maybe we are passing twice as much data to the function than it expects. The Windows API functions are invoked with stdcall, and that cleans up the stack when returning. The exception you are getting is a warning in Visual Studio from Pinvoke that the stack pointer is not in the same position as before you called the function. This case is already resolved in the latest internal build, so feel free to download it and give it a try.
     
    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 17 Apr 2012 Link to this post

    I just got the PInvoke, unbalanced stack error too.
    Downloaded the latest internal build, v412.20.
    Upgraded my project. Issue is fixed.

    I don't see instructions anywhere for loading and internal build, so here is what I do:
    1. Download the internal build zip file.
    2. Unzip the package into C:\Users\_myuser_\AppData\Roaming\Telerik\Updates.
    3. In VS, right click the project, go to RadControls for WinForms.
    4. Use wizard to upgrade - the directory unpacked from the zip should be detected and the new build should be available.
    5. VS must restart to load the new toolbox.

    Note1: I run VS in administrator mode and I had two instances of VS open when I did the upgrade. Unfortunately VS didn't restart properly and needed to be killed. There was no indication that UAC was involved or any other error. I suspect this was related to the toolbox being locked or some other resource contention.

    Note2, the version notes on the internal builds don't include info about all of the updates.
    http://www.telerik.com/versionnotes.aspx?nb=1&id=1976
    For example, the v412 build doesn't mention this PInvoke issue.

    So, after all of that -  does Telerik provide instructions for this anywhere? Please consider adding a README.txt to the zip!

    HTH

  4. jed
    jed avatar
    9 posts
    Member since:
    Feb 2012

    Posted 18 Apr 2012 Link to this post

    Thanks for the Instruction!

    Had same problem, and its solved now with 412.

    @Telerik add TonyG's post as readme in the zip file
  5. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 20 Apr 2012 Link to this post

    Unfortunately there was a side effect of my update. Now, every time I restart VS now my toolbox is trashed. There are duplicates of RadControls in some toolbox tabs and many controls are now missing. I sort each group, delete extras, restart, and they just come back.  All of the non-Telerik controls? They're fine.

    I have to say, this is the most (maybe only) irritating aspect of the RadControls package. I'm a huge fan, enjoy working with the software, and really enjoy the "Wow!" from my clients when they start seeing screens developed. But a couple times per year VS gets trashed like this and I need to uninstall all of the RadControls hooks, then reinstall in order to get back to a decent baseline. Where is all of the improved productivity that I'm supposed to be deriving from this?

    I'm sorry, I'm just ticked at losing a couple hours on a fun project.

    I'll leave the door open and assume that the issue is related to this being a "dev hotfix" and subject to transient issues.

    A solution to this problem short of full reinstall would be most welcome.

    EDIT: BTW, yes, all of the WinControls assemblies are 2012.1.412.20. The dupes in the toolbox all show the tooltip for that build. In Choose Toolbox Items I see many controls for that build selected, and there are many v2012.1.12.215 components which don't have a 412.20 update.  I'm starting to wonder if I should be seeing *.412.40 (for .NET4 rather rather than .NET2) ?

    Was the wrong set of assemblies detected?
  6. Andrey
    Admin
    Andrey avatar
    245 posts

    Posted 20 Apr 2012 Link to this post

    Hello Tony,

    Thank you for bringing this to our attention.

    You are indeed right that the version notes do not mention the fix. The reason for this is that on April 2nd, we had an internal build including the mentioned fix. Then, on April 10th we had another internal build, based on the first one with a few more fixes, however, the release notes are not cumulative as they should be. The release notes are now updated with the appropriate information. 

    About the steps you used to deploy the .zip file - they are not highlighted in any document, as you needn't perform them. All you need to do is enable the use of internal builds through the VSExtensions options dialog (more info) and use the Download... button in the Upgrade Wizard.

    As for the toolbox issues you have been experiencing, I suspect they are mostly related to the way Visual Studio picks up assemblies when automatically setting up the toolbox.

    The following typically resets the toolbox in terms of Telerik controls:
    1. Close all the Visual Studio instances
    2. Start Windows Explorer
    3. Navigate to the following folder: %localappdata%\Microsoft\VisualStudio\10.0
    4. Delete all the *.tbd files (you might need to change Windows Explorer settings to see all the hidden and system files)

    About the .NET 4.0 and .NET 2.0 assemblies. The separate control builds were introduced recently and the case might just be caused by you using an old version of our VSExtensions. You can just open the Visual Studio Extension Manager and make sure you are using the latest Telerik VSExtensions (v. 2012.1.320.0 as of today).

    Kind regards,

    Andrey
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  7. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 20 Apr 2012 Link to this post

    Andrey, that's all great info and I sincerely thank you for the time you've taken to investigate and document the various concerns. This is yet another reason why I'm such a huge fan of Telerik. :)

    About getting internal builds through VSExtensions. Yes, that's there, but on a day to day basis developers probably want that unchecked. I believe the procedure you'd recommend is that we identify a fix is available, open VS, check the box, go to the Upgrade Wizard for our project, install the latest internal build, then go back and uncheck the auto-update from internal builds. That process is (arguably) easier than the one I described, but still a procedure that developers must be aware in order to achieve the desired goal. So if we're following a script it sort of doesn't matter which one it is, but it needs to be documented somewhere. :)

    As possible, I humbly request that your VSExtensions people discuss this, the goal being to help developers identify and install a build to suit their current situation, but without installing daily builds which could wreak havoc on application debugging. I'm thinking there should be a button that says "I want to try the latest build now" (in each of the product areas, AJAX, WinForms, etc) and a dialog displays to show how to make that happen. It should link to the release notes for the current build and then advise the developer on how to download and use the update. This could mean just a small bit of work from your people.

    Please comment if I'm not properly understanding this process.

    I'll zap my toolbox this weekend as you described and note back here on the success. (Sorry for polluting this thread, it's a shame we can't easily fork discussions into another thread or forum category... then again, there's no forum for VSExtensions or Internal Builds ... hint hint...).
  8. Andrey
    Admin
    Andrey avatar
    245 posts

    Posted 25 Apr 2012 Link to this post

    Hi Tony,

    There is a forum for Visual Studio Extensions - Link.

    Your idea makes a lot of sense. I have logged it in our internal database. As we already have a planned revamp of the VSExtensions' UI coming up next quarter, you can expect improvements sooner rather than later.

    The only thing I want to make clear here is - enabling internal builds in the VSExtensions options will not download internal builds without your consent. All it will do is present a prompt every week, as we release our weekly build.

    Regards,
    Andrey
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top