HRESULT E_FAIL has been returned from a call to a com component

4853
20
09-17-2010 05:17 AM
NagmaYasmin
Occasional Contributor III
Hi,

I started to get HRESULT error when trying to solve network dataset in Arc10 programatically. In 9.3, the code works fine. It is in vb.net. In program i added code to release object and garbage collector, but nothing helps.

Any idea? Appreciate any help.


Nagma
Tags (2)
0 Kudos
20 Replies
MichaelRice
New Contributor III
Can you post your code (or at least, the portion of the code where you are getting errors)?
0 Kudos
NagmaYasmin
Occasional Contributor III
Hi Micael,

Thanks so much for your reply. I am trying create a route usining couple of stops. I am getting error in this line at the bottom of attached document:

m_pNAContext.Solver.Solve(m_pNAContext, pGPMessages, Nothing)

Please see the attcahed code. I added some code to release system resource, but doesn't work.

In 9.3, didn't get any error, but it started to happen in Arc10.

Thanks for your help.

Nagma
0 Kudos
MichaelRice
New Contributor III
I see in your code that you have a try/catch block around the solve and you report the first GPMessage returned by the solver upon failure. Have you checked to see if there are any other messages in the GPMessages object? There can be multiple messages, and there may be more detailed information in this object that will help to narrow down the problem. Try this first, and we can proceed from there.
0 Kudos
NagmaYasmin
Occasional Contributor III
Thanks. In catch I get com exception but for gpMessages I get the message "Value does not fall within expected range". Don't have any idea why in Arc10 I get this message.



I see in your code that you have a try/catch block around the solve and you report the first GPMessage returned by the solver upon failure. Have you checked to see if there are any other messages in the GPMessages object? There can be multiple messages, and there may be more detailed information in this object that will help to narrow down the problem. Try this first, and we can proceed from there.
0 Kudos
MichaelRice
New Contributor III
Is this the only message in the GPMessages object, or just the first message? If there are more, can you report those as well?
0 Kudos
NagmaYasmin
Occasional Contributor III
Yes, this is the only message I get. There is also stack trace, may be that will help. Please see the attcahed document.

Thanks
0 Kudos
MichaelRice
New Contributor III
Looking at your last email, the error appears to be coming from a call to some IArray variable. This is likely coming from one of the IStringArray variables passed to the solver (e.g., for accumulate attribute names, etc.).

In your code, I notice you have the following:

' Dim AccumulateAttributes As IStringArray 'changed 09_16
Dim AccumulateAttributes As StrArray

Is there a reason you recently changed this code from using the IStringArray interface? Perhaps this is somehow part of the problem. Can you change the code back to how it was or comment out your use of the accumulate attributes altogether to see if this is the issue?
0 Kudos
NagmaYasmin
Occasional Contributor III
I changed the code after I started to get the error, I thought there might have changed in Arc10. I got back to original code, it is the same error I am getting.



Looking at your last email, the error appears to be coming from a call to some IArray variable. This is likely coming from one of the IStringArray variables passed to the solver (e.g., for accumulate attribute names, etc.).

In your code, I notice you have the following:

' Dim AccumulateAttributes As IStringArray 'changed 09_16
Dim AccumulateAttributes As StrArray

Is there a reason you recently changed this code from using the IStringArray interface? Perhaps this is somehow part of the problem. Can you change the code back to how it was or comment out your use of the accumulate attributes altogether to see if this is the issue?
0 Kudos
NagmaYasmin
Occasional Contributor III
Any ideas? Why is it happening only in Arc10? Thanks for any help.
0 Kudos