I have spent the past two days trouble shooting my application trying to pin point the problem.
here is the issue
I have a MicroStation C# Addin. this application will write things to an excel file. this excel file is within projectwise.
if the use already has the excel file checked out and opened then it will find and attach to the running instance.
if the file is not open it will check it out and open it then it will find and attach to the running instance of excel.
when its done writing to excel I leave the excel file checked out, unsaved, and opened. I allow the end use to decide what to do with the excel file.
When the end user goes to close the file and they get prompted to check it back in. when they select check in they get another message box saying that the file is still in use..
So I thought at first it was my code not property releasing the excel COM object. Well after trying several things I found that I was releasing it properly. So I continued on to see what else it could be.
Well I found it..
when I call the aaApi_OpenDocument call it will open the excel file. if all I do in my code is open the document and then stop (so that's not connecting to the COM object or adding data to excel or anything). So really all I did was call an Api call to open the document. Now if the use try's to check in the file they get the message imaged above.
So I'm thinking this API call has something wrong with it. don't know if its not property releasing the COM object or leaking that memory... it might be limited to a problem with just excel not sure.
Anyone have any ideas how to fix this problem. Am I doing something wrong? I don't know how I can go wrong with one api call that just opens a file. wasted two days on this to find out the problem is the api call, pretty frustrated at this point.
You are opening the document from a session of Microstation using ProjectWise Explorer which launches Excel, then leaving it up to the end user to do something. That seems to be a lot of handles on the document. It becomes more complex if the Microstation document was opened from ProjectWise.
well yes it is a microstation addin. im integrating it with ProjectWise. So yes the user opens the microstation dgn file from ProjectWise (we have a managed workspace). now within microstation the user launches the addin. this addin will already have the session of ProjectWise since microstation was opened from ProjectWise (so no need to log in).
Now this addin does things like pull info from the dgn file, then when the user is ready they hit a button to output this info to an excel file. the excel file already exists in PW (its a template that gets filled out for every project).
I have limited my code to only open the document and do nothing else. all I do is use the aaApi_OpenDocument() api call. that should not be holding onto anything but it is.
I don't think that's a lot of handles on the document. and its not that out of the question to want to open a document.
I defiantly seems like its not releasing the excel COM object property.
not ruling out its something in my code but I removed everything except opening the file.
Robert Hook
is this on a schedule to be fixed? still doesn't seems to be fixed yet.
Hi John Drsek,
Arnab Gogoi informed me of your follow up question here.
Defect 1086379 has been addressed with a fix.
Configuration variable PW_ADD_FETCHED_DOCS_TO_IN_USE_LIST Added and Documented in ..\ProjectWise\bin\mcm.user.cfg; in ProjectWise Explorer Client MCM Integration in 10.00.03.326 and later builds.
Please note the version referenced is an internal build and a public release should become available shortly; likely end of 2021-Q1 (Related).
For further product release information make sure to follow the Content Management Announcements Forum and/or feel free to Search and Ask questions on the Content Management Forum.
HTH,Bob
Answer Verified By: John Drsek
Robert Hook said:The defect has been addressed with a fix (new configuration variable being added) in ProjectWise Explore
I installed 10.00.03.434 of PW explorer and tested and the problem still exists. you mention a configure variable. is this something in the MCM.cfg file?
Please note I have updated my suggested answer above to contain all information to resolve the issue (today) in that one spot.
Thanks Robert!
IT WORKS!!!!
for people doing this in c# the mcm.user.cfg file has the example of what to do but not in C#...it would look something like this..
using BD = Bentley.DgnPlatformNET; ... string strValFetchedDocsVar = ""; if (BD.ConfigurationManager.IsVariableDefined("PW_ADD_FETCHED_DOCS_TO_IN_USE_LIST")) { strValFetchedDocsVar = BD.ConfigurationManager.GetVariable("PW_ADD_FETCHED_DOCS_TO_IN_USE_LIST"); } BD.ConfigurationManager.DefineVariable("PW_ADD_FETCHED_DOCS_TO_IN_USE_LIST", "0"); //open selected file bool isOpen = PWWrappers.aaApi_OpenDocument(projectID, DocID, false); if(isOpen == true) { MessageBox.Show("Successfully opened selected document"); } else { string errormsg = PWWrappers.aaApi_GetLastErrorMessage() + " \n " + PWWrappers.aaApi_GetLastErrorDetail(); MessageBox.Show("Failed to open selected document \n " + errormsg); } if (strValFetchedDocsVar == "") { BD.ConfigurationManager.UndefineVariable("PW_ADD_FETCHED_DOCS_TO_IN_USE_LIST"); } else { BD.ConfigurationManager.DefineVariable("PW_ADD_FETCHED_DOCS_TO_IN_USE_LIST", strValFetchedDocsVar); }