Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-15-2004, 12:02 PM
mteutsch mteutsch is online now
Registered User
 
Join Date: 11-15-2004
Posts: 4
Angry VisBuild.Pro - Application Error too

I used VisualBuildPro to create some user-defined actions using VB.NET. After some simple operations:
- creating a MACRO
- removing the MACRO
- logging some TEXT
VisualBuildPro crashes constantly at process shutdown:
The instruction at 0x... references memory at 0x00000027. The memory could not be "read".

I'm using the most recent version of VisualBuildPro (5.5), but I had the same problem with version 5.4. It is officially licenced and I've got it directly from your site.
Whats most intriguing, the VC++ 7.0 version of the ud-action doesn't show the same problem. The application terminates normally.
I've used the VBNETAction-sample included within the software package to test this behavior and built my own COM-Server in VC++ 7.0 to recheck.

Attachments:
- the zipped VC++ project with the .action-file: Test2.zip
- the image of the crash message: crash.jpg
- the modified source from VBNETAction: Test.vb
Attached Files
File Type: zip vbpro_error.zip (27.3 KB, 1494 views)
Reply With Quote
  #2  
Old 11-15-2004, 03:36 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
I'm not able to reproduce that behavior here, but something that might help:

Try

Builder.App.Macros(VisBuildSvr.MacroTypeEnum.vbldM acroTemporary).Add("TestMACRO", "", "", "", False)
Builder.App.Macros(VisBuildSvr.MacroTypeEnum.vbldM acroTemporary).Remove("TestMACRO")
Builder.LogMessage("TestTEXT", True)

BuildStep = VisBuildSvr.StepStatusEnum.vbldStepStatSucceeded

Catch e As Exception

BuildStep = VisBuildSvr.StepStatusEnum.vbldStepStatFailed
Builder.LogMessage(e.Message)

Finally

' release our references to COM objects passed in
System.Runtime.InteropServices.Marshal.ReleaseComO bject(Builder)
System.Runtime.InteropServices.Marshal.ReleaseComO bject([step])

End Try
Reply With Quote
  #3  
Old 11-16-2004, 09:20 AM
mteutsch mteutsch is online now
Registered User
 
Join Date: 11-15-2004
Posts: 4
That's not the point. There is no exception triggered at run time. The aforementioned crash occurs when I try to close Visual Build Pro after finishing the script.
Reply With Quote
  #4  
Old 11-16-2004, 09:36 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
I understand. But since this is occurring for you only from a managed plug-in, I suspect it has to do with proper lifetime management of COM resources in the .NET runtime, and the code sample shows how to ensure proper cleanup of these resources.
Reply With Quote
  #5  
Old 11-16-2004, 10:36 AM
mteutsch mteutsch is online now
Registered User
 
Join Date: 11-15-2004
Posts: 4
I see. Well, i tried the code sample, but it doesn't help. I noticed that only Win2000 seems to be affected. I couldn't reproduce the error in WinXP.
Reply With Quote
  #6  
Old 11-16-2004, 11:59 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
I was testing on Win XP, which explains why I couldn't reproduce it. I was able to reproduce this behavior on Win2K. Here's the fix:

Dim macro As VisBuildSvr.IMacro = Nothing

Try

macro = Builder.App.Macros(VisBuildSvr.MacroTypeEnum.vbldM acroTemporary).Add("TestMACRO", "", "", "", False)
Builder.App.Macros(VisBuildSvr.MacroTypeEnum.vbldM acroTemporary).Remove("TestMACRO")
Builder.LogMessage("TestTEXT", True)

Builder.LogMessage("Hello from VB.NET custom action in project ")
Builder.LogMessage([step].ExpProperty(Builder, "Msg"))
BuildStep = VisBuildSvr.StepStatusEnum.vbldStepStatSucceeded

Catch e As Exception

BuildStep = VisBuildSvr.StepStatusEnum.vbldStepStatFailed
Builder.LogMessage(e.Message)

Finally

' release our references to COM objects we use
System.Runtime.InteropServices.Marshal.ReleaseComO bject(Builder)
System.Runtime.InteropServices.Marshal.ReleaseComO bject([step])
If Not macro Is Nothing Then System.Runtime.InteropServices.Marshal.ReleaseComO bject(macro)

End Try
Reply With Quote
  #7  
Old 11-16-2004, 12:24 PM
mteutsch mteutsch is online now
Registered User
 
Join Date: 11-15-2004
Posts: 4
Smile

Yes, this DID solve the problem.
Could you give me some background why the automatical release of the COM-objects fails here?

Thanks for the help
Michael
Reply With Quote
  #8  
Old 11-16-2004, 12:36 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
VBP itself doesn't hold any references to that macro after it has been removed. But its implementation does require that child objects (the macro in this case) not outlive their parent (application). I guess the reference that the .NET runtime is holding is not cleaned up soon enough without explicitly releasing it.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 02:59 PM.


Copyright © 1999-2023 Kinook Software, Inc.