Private method access - wrong

Explore, browse and analyze .NET assemblies

Moderators: Luke Jefferson, Clive Tong, nick.maidment

Private method access - wrong

Postby alehandro » Thu Feb 03, 2011 11:00 pm

Hi,
I've seen in some assemblies the following issue:

when a class implements some interface, the implemented methods cant be private, dont know if its up to protector or smth else. Is it possbile to add analysis in Refl to make these methods public?

example


source module with issues
=================

using System;
using System.Runtime.InteropServices;

public class c000806 : afv, IDisposable
{
private int f000002;
private int f00002f;
private IntPtr f000058;

public c000806(int A_0)
{
this.f000058 = Marshal.AllocCoTaskMem(A_0);
this.f000002 = A_0;
}

public void Dispose()
{
if (this.f000058 != IntPtr.Zero)
{
Marshal.FreeCoTaskMem(this.f000058);
this.f000058 = IntPtr.Zero;
GC.SuppressFinalize(this);
}
}

~c000806()
{
this.Dispose();
}

public int m00000c()
{
return this.f00002f;
}

private int m000025(int A_0)
{
if (A_0 > this.f000002)
{
return -2147483645;
}
this.f00002f = A_0;
return 0;
}

private int m000025(out int A_0)
{
A_0 = this.f000002;
return 0;
}

public void m00003f(int A_0)
{
if (this.f00002f > this.f000002)
{
throw new ArgumentException("Cannot be greater than maximum buffer size");
}
this.f00002f = A_0;
}

private int m00055e(IntPtr A_0, IntPtr A_1)
{
if (A_0 != IntPtr.Zero)
{
Marshal.WriteIntPtr(A_0, this.f000058);
}
if (A_1 != IntPtr.Zero)
{
Marshal.WriteInt32(A_1, this.f00002f);
}
return 0;
}

public void m0009b5(byte[] A_0, int A_1)
{
this.m00003f(A_1);
Marshal.Copy(A_0, 0, this.f000058, A_1);
}

public void m000d5c(byte[] A_0, int A_1)
{
Marshal.Copy(this.f000058, A_0, A_1, this.m00000c());
}
}


interface
================
using System;
using System.Runtime.InteropServices;
using System.Security;

[ComImport, Guid("59eff8b9-938c-4a26-82f2-95cb84cdc837"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), SuppressUnmanagedCodeSecurity]
public interface afv
{
[PreserveSig]
int m000025(int A_0);
[PreserveSig]
int m000025(out int A_0);
[PreserveSig]
int m00055e(IntPtr A_0, IntPtr A_1);
}





issues
================

Error 3 'c000806' does not implement interface member 'afv.m000025(int)'. 'c000806.m000025(int)' cannot implement an interface member because it is not public.
Error 2 'c000806' does not implement interface member 'afv.m000025(out int)'. 'c000806.m000025(out int)' cannot implement an interface member because it is not public.
Error 1 'c000806' does not implement interface member 'afv.m00055e(System.IntPtr, System.IntPtr)'. 'c000806.m00055e(System.IntPtr, System.IntPtr)' cannot implement an interface member because it is not public. \\NS371857150\\c000806.cs 4 14
Last edited by alehandro on Tue Feb 15, 2011 9:16 pm, edited 1 time in total.
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am

Postby alehandro » Thu Feb 03, 2011 11:03 pm

another sample:


public class c00086a : IDisposable
{
....

private void Dispose() << private!!!??
{
try
....
}
}

Error 54 'c00086a' does not implement interface member 'System.IDisposable.Dispose()'. 'c00086a.Dispose()' cannot implement an interface member because it is not public.
Last edited by alehandro on Tue Feb 15, 2011 9:15 pm, edited 1 time in total.
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am

Postby Clive Tong » Thu Feb 10, 2011 12:09 pm

I've logged that as RP-1028.
Clive Tong
 
Posts: 283
Joined: Thu Dec 04, 2008 5:42 pm

Licensing

Postby screenpresso » Tue Feb 15, 2011 5:53 pm

Hi,
I am from Screenpresso software development team and I would be pleased to know why you, alehandro, are trying to disable our software which is something illegal.
If you have any questions, fell free to contact us.
Regards,
Screenpresso team
screenpresso
 
Posts: 1
Joined: Tue Feb 15, 2011 5:49 pm

Postby alehandro » Tue Feb 15, 2011 9:07 pm

Hi,
I'm glad you are reading my poor posts
Well, of course I"m not trying to disable any SW, my only aim was to make the tool more correct in some specific cases.
As you see that case was to correct public/private visibility of members.

My apoligies if I offend you.
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am


Return to .NET Reflector 7 EAP

Who is online

Users browsing this forum: No registered users and 0 guests

cron