This is a migrated thread and some comments may be shown as answers.

Wrong: Cast not required

1 Answer 66 Views
Code Analysis
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matthias Bibo
Top achievements
Rank 1
Matthias Bibo asked on 14 Jun 2012, 12:44 PM

The analysis does not recognize dynamic objects, so it shows an cast as redundant, although it isnĀ“t!!

On dynamic object a cast is required, although it has the correct type.

e.g.

this.CurrentCallState = (TAPI_CALLSTATE)eventArgs   <----the NOT redundant cast


--> For more infos see the attached picture "JC-CastAnalysis.jpg"


private void TapiActiveX_OnCallStateChange(dynamic eventArgs)
        {
            this.LastCallState = this.CurrentCallState;
            this.CurrentCallState = (TAPI_CALLSTATE)eventArgs;
  
            // wenn hereinkommender Anruf und dann weg (IDLE oder diconnected), dann ist es ein Missed Call
            if (this.LastCallState == TAPI_CALLSTATE.CALLSTATE_OFFERING
                 && (this.CurrentCallState == TAPI_CALLSTATE.CALLSTATE_IDLE
                     || this.CurrentCallState == TAPI_CALLSTATE.CALLSTATE_DISCONNECTED))
            {
                CallHistoryEntry entry = new CallHistoryEntry() { Id = -1, PhoneNumber = this.PhoneNumber, IsMissed = true, InsertDate = DateTime.Now };
                this.CallHistory.Add(entry);
            }
  
            if (this.OnCallStateChange != null)
            {
                TapiEventArgs tapiEventArgs = new TapiEventArgs();
  
                this.OnCallStateChange(this, tapiEventArgs);
            }
        }

1 Answer, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 20 Jun 2012, 10:55 AM
Hi,

Thank you for your feedback. I was able to reproduce your issue and we are going to do our best to fix it as soon as possible.
Thank you for your help!

All the best,
Ivan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Code Analysis
Asked by
Matthias Bibo
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Share this question
or