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

JustCode lists error "Unknown Method" when using named parameters and an extension method.

11 Answers 226 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.
Jeff
Top achievements
Rank 1
Jeff asked on 27 Jul 2011, 02:49 PM
In my C# / .NET 4 project, I have an extension method defined with the following signature:

    public static PFPrincipal Setup(this PFPrincipal principal, string name = "TEST", long userId = 1, long company = 1, string loginType = "P", LoginOrigin loginOrigin = LoginOrigin.Unspecified, long? subscriptionId = null, params string[] roles)<br>

In my code, I use this extension method by specifying some of the named parameters:

      PFPrincipal.Current.Setup(loginOrigin: LoginOrigin.WebService, subscriptionId: 1);

JustCode marks this in the Errors window as:

C#: Unknown method 'Setup(loginOrigin:=MyApp.DataTypes.LoginOrigin, subscriptionId:=int)' of 'MyApp.Security.PFPrincipal'

The actual code compiles and runs fine, only JustCode does not like it.

11 Answers, 1 is accepted

Sort by
0
Stefan Avramov
Telerik team
answered on 28 Jul 2011, 12:18 PM
Hi Jeff,

 Thanks for the feedback. We logged the issue for fixing and added a PITS item for you here. You also receive some Telerik Points.

Best wishes,
Stefan Avramov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
ajpetersen
Top achievements
Rank 1
answered on 24 Aug 2011, 03:25 PM
I think I am having the same problem as above, but I wasn't sure. I am using vb.net and I have a property that is defined in a Module.

Public ReadOnly Property _IsReportingToTr(dealerInfo As DealerInfo) As Boolean
    Get
        Dim trService As New TraceRegisterService()
        If DealerInfo.TraceRegisterID Is Nothing Then
            Return False
        Else
            Return trService.GetTraceRegisterAccountById(DealerInfo.TraceRegisterID).IsReportingToTr
        End If
    End Get
End Property
'This is where I call it. _ActiveDealerInfo calls another property that gets the Active Dealer Info
_IsReportingToTr(_ActiveDealerInfo)

JustCode is giving me an error: Unknown Method '_IsReportingToTr'

Other properties in the module run fine and don't show errors as long as a parameter is not being passed through.

The project compiles and runs fine.
0
ajpetersen
Top achievements
Rank 1
answered on 29 Aug 2011, 08:43 PM
Is this the same issue?
0
Stefan Avramov
Telerik team
answered on 30 Aug 2011, 12:49 PM
Hi Claude,

Sorry for the late reply. No - this is a different issue. Can you send us a compilable sample where this occurs. The code you provided generates a real build error - "Property access must assign to the property or use its value". JustCode shows no errors if we fix the error by adding a variable there like so:

Dim a = _IsReportingToTr(_ActiveDealerInfo)

Thanks in advance.

Regards,
Stefan Avramov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
ajpetersen
Top achievements
Rank 1
answered on 30 Aug 2011, 02:25 PM
Winform's Code Behind:
 
Sorry if the first code sample did not compile. This sample defiantly does and JustCode still gives
the Unknown method '_IsReportingToTr'

   
Private Sub frmSendData_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        If _IsReportingToTr(_ActiveDealerInfo) Then
            LoadLvBatches(Nothing, Nothing)
        Else
            HideTrControls()
        End If
      End Sub
 
 
Module Properties:
 
     Public ReadOnly Property _IsReportingToTr(dealerInfo As DealerInfo) As Boolean
        Get
            Dim trService As New TraceRegisterService()
            If dealerInfo.TraceRegisterID Is Nothing Then
                Return False
            Else
                Return trService.GetTraceRegisterAccountById(dealerInfo.TraceRegisterID).IsReportingToTr
            End If
        End Get
    End Property
 
 
    Public Property _ActiveDealerInfo() As DealerInfo
        Get
            DiService = New DealerInfosService()
            Return DiService.GetActiveDealerInfo()
        End Get
        Set(value As DealerInfo)
            DiService.SaveDealerInfo(value)
        End Set
    End Property
0
Stefan Avramov
Telerik team
answered on 01 Sep 2011, 10:26 AM
Hi Claude,

Thanks a lot for taking the time to help us. We managed to reproduce the issue and logged it for fixing. I created a PITS item for you here. You also receive some Telerik Points to compensate you for the effort.

Kind Regards,
Stefan Avramov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Dinis
Top achievements
Rank 1
answered on 06 Dec 2012, 06:05 PM
Has this been fixed?

I just installed JustCode and am having the exact same problem (none of my Extension methods are working)
0
Dinis
Top achievements
Rank 1
answered on 06 Dec 2012, 07:23 PM
For a screenshot of the problem I had see the Just tried JustCode and its a shame they don't support ExtensionMethods blog post
0
Zdravko
Telerik team
answered on 07 Dec 2012, 02:07 PM
Hello,

 Thanks for the feedback Dinis.
I reproduced your issue and it seems that JustCode does not look for dll references in the Bin folder and that is why it shows the errors. If you add a reference to the O2_FluentSharp_CoreLib.dll the errors will disappear. I will make an item for this issue and we will investigate it.

I would like to ask you what is the type of your TM_Website project?
Thank you.

Greetings,
Zdravko
the Telerik team
Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
0
Developers
Top achievements
Rank 1
answered on 24 Jun 2013, 06:39 PM
JustCode could not find  references in its bin folder, it ended up with Unknown Method Errors,   this issue is fixed or not ? but I upgrade JustCode today, the problem still exist. that is very annoying. is there another approach to get rid of this warning ?
0
Ivan
Telerik team
answered on 27 Jun 2013, 10:44 AM
Hi,

We have fixed the issue and the fix will be released in our next internal build.
Thank you for your help!

Regards,
Ivan
Telerik
Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
Tags
Code Analysis
Asked by
Jeff
Top achievements
Rank 1
Answers by
Stefan Avramov
Telerik team
ajpetersen
Top achievements
Rank 1
Dinis
Top achievements
Rank 1
Zdravko
Telerik team
Developers
Top achievements
Rank 1
Ivan
Telerik team
Share this question
or