Click here to Skip to main content
15,925,661 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: How to prevent decompilation of vb.net exe or dll? Pin
bindasrakesh29-Nov-10 21:59
bindasrakesh29-Nov-10 21:59 
QuestionMOSS Pin
Gunjan pandey17-Sep-09 23:09
Gunjan pandey17-Sep-09 23:09 
AnswerRe: MOSS Pin
Richard MacCutchan17-Sep-09 23:55
mveRichard MacCutchan17-Sep-09 23:55 
AnswerRe: MOSS Pin
Not Active18-Sep-09 1:50
mentorNot Active18-Sep-09 1:50 
Questionhow to pass excel application object to automation object? Pin
SRKSHOME17-Sep-09 20:50
SRKSHOME17-Sep-09 20:50 
AnswerRe: how to pass excel application object to automation object? Pin
Richard MacCutchan17-Sep-09 22:54
mveRichard MacCutchan17-Sep-09 22:54 
QuestionHow to deserialize on top of an existing object? Pin
RichardM117-Sep-09 16:49
RichardM117-Sep-09 16:49 
QuestionLinkDemands and FxCop [modified] Pin
Gideon Engelberth17-Sep-09 4:54
Gideon Engelberth17-Sep-09 4:54 
I ran FxCop over my assembly and got the warning about not indirectly exposing methods with LinkDemands (CA2122 help link). The original code was like this (Marshal.GetLastWin32Error is the method with the LinkDemand):
VB
Dim extendedStyle As Integer = NativeMethods.GetWindowLong(hwnd, GWL_EXSTYLE)
If extendedStyle = 0 Then
     Throw New System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error())
End If


I then moved the exception throwing into a method on the NativeMethods class and the code now looks like this:
VB
Dim extendedStyle As Integer = NativeMethods.GetWindowLong(hwnd, GWL_EXSTYLE)
If extendedStyle = 0 Then
    NativeMethods.ThrowWin32Error()
End If

<SecurityPermission(SecurityAction.Demand, UnmanagedCode:=True)> _
Friend Module NativeMethods
    Friend Sub ThrowWin32Error()
        Throw New System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error())
    End Sub

    'other code here
End Module


As expected, the original method is no longer flagged by FxCop. I expected the new NativeMethods.ThrowWin32Error to be flagged, but it is not. Neither the NativeMethods class nor the method have any attributes. Does anyone know more about LinkDemands or this warning that could provide an explanation for why this is not flagged? (EDIT: I am getting the FxCop warning now without the attribute.) Is applying a SecurityPermission attribute the right way to deal with that warning?

I am getting the same message for the serialization constructors of Exceptions that call GetObjectData, and I assume that whatever I end up doing for this situation will need to be done for them too.

modified on Thursday, September 17, 2009 1:51 PM

QuestionGetting the current Windows Session user from a different User Domain Pin
Tristan Rhodes16-Sep-09 6:30
Tristan Rhodes16-Sep-09 6:30 
GeneralVS SDK: How to apply additional formatting after (not instead) default colorization. Pin
Sergiy Sakharov16-Sep-09 3:58
Sergiy Sakharov16-Sep-09 3:58 
Questionupzip a folder in vb.net Pin
nicetohaveyou15-Sep-09 21:36
nicetohaveyou15-Sep-09 21:36 
AnswerRe: upzip a folder in vb.net Pin
Eddy Vluggen16-Sep-09 5:16
professionalEddy Vluggen16-Sep-09 5:16 
QuestionWeb Camera settings Pin
Raj Jayaswal15-Sep-09 6:56
Raj Jayaswal15-Sep-09 6:56 
AnswerRe: Web Camera settings Pin
Manas Bhardwaj16-Sep-09 8:45
professionalManas Bhardwaj16-Sep-09 8:45 
QuestionDo Microsoft .NET Certificates Expire ? Pin
Hristiyan15-Sep-09 2:48
Hristiyan15-Sep-09 2:48 
AnswerRe: Do Microsoft .NET Certificates Expire ? Pin
Kevin McFarlane15-Sep-09 3:26
Kevin McFarlane15-Sep-09 3:26 
GeneralRe: Do Microsoft .NET Certificates Expire ? Pin
Not Active15-Sep-09 6:58
mentorNot Active15-Sep-09 6:58 
GeneralRe: Do Microsoft .NET Certificates Expire ? Pin
Kevin McFarlane15-Sep-09 8:01
Kevin McFarlane15-Sep-09 8:01 
GeneralRe: Do Microsoft .NET Certificates Expire ? Pin
Not Active15-Sep-09 9:31
mentorNot Active15-Sep-09 9:31 
GeneralRe: Do Microsoft .NET Certificates Expire ? Pin
Kevin McFarlane15-Sep-09 12:20
Kevin McFarlane15-Sep-09 12:20 
GeneralRe: Do Microsoft .NET Certificates Expire ? Pin
Not Active15-Sep-09 13:22
mentorNot Active15-Sep-09 13:22 
AnswerRe: Do Microsoft .NET Certificates Expire ? Pin
Pete O'Hanlon15-Sep-09 3:57
mvePete O'Hanlon15-Sep-09 3:57 
GeneralRe: Do Microsoft .NET Certificates Expire ? Pin
Hristiyan15-Sep-09 4:32
Hristiyan15-Sep-09 4:32 
GeneralRe: Do Microsoft .NET Certificates Expire ? Pin
Eddy Vluggen15-Sep-09 4:41
professionalEddy Vluggen15-Sep-09 4:41 
GeneralRe: Do Microsoft .NET Certificates Expire ? Pin
Pete O'Hanlon15-Sep-09 4:53
mvePete O'Hanlon15-Sep-09 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.