Red Gate forums :: View topic - Private method access - wrong
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
.NET Reflector 7 EAP
.NET Reflector 7 EAP forum

Private method access - wrong

Search in .NET Reflector 7 EAP forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
alehandro



Joined: 16 Nov 2010
Posts: 35

PostPosted: Thu Feb 03, 2011 11:00 pm    Post subject: Private method access - wrong Reply with quote

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
Back to top
View user's profile Send private message
alehandro



Joined: 16 Nov 2010
Posts: 35

PostPosted: Thu Feb 03, 2011 11:03 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Clive Tong



Joined: 04 Dec 2008
Posts: 283

PostPosted: Thu Feb 10, 2011 12:09 pm    Post subject: Reply with quote

I've logged that as RP-1028.
Back to top
View user's profile Send private message
screenpresso



Joined: 15 Feb 2011
Posts: 1

PostPosted: Tue Feb 15, 2011 5:53 pm    Post subject: Licensing Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
alehandro



Joined: 16 Nov 2010
Posts: 35

PostPosted: Tue Feb 15, 2011 9:07 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group