Errore su un'implementazione IComparer. Per favore aiuto !
Domanda
Ho creato un selezionatore matrice di matrici di ordinamento come in Win Explorer in un modulo DNN. Come in risposta a una domanda di anteprima:
Un utente sta ottenendo il seguente errore (sotto) ogni volta che corrono il modulo, io non sono uno sviluppatore ASP.NET particolarmente stagionati. E 'questo errore ha causato becuase ho usato StrCmpLogicalW nel mio IComparer e viene utilizzato su una piattaforma che non supporta StrCmpLogicalW. O è causato becuase di un problema di autorizzazioni.
Ogni aiuto è molto appriciated,
Grazie mille enorme.
Ecco il selezionatore che causa l'errore.
Public Class nvSorter
Implements IComparer(Of String)
Declare Unicode Function StrCmpLogicalW Lib "shlwapi.dll" ( _
ByVal s1 As String, _
ByVal s2 As String) As Int32
Public Function Compare(ByVal x As String, ByVal y As String) As Integer Implements System.Collections.Generic.IComparer(Of String).Compare
Return StrCmpLogicalW(x, y)
End Function
End Class
E questo è l'analisi dello stack Eccezione:
InnerException: Impossibile confrontare due elementi dell'array.
Messaggio: DotNetNuke.Services.Exceptions.PageLoadException: Impossibile confrontare due elementi dell'array. --- |> System.InvalidOperationException: Impossibile confrontare due elementi dell'array. --- |> System.Security.SecurityException: System.Security.Permissions.SecurityPermission a Nukeville.Modules.SkinLab.View.nvSorter.Compare (String y di stringa) a System.Collections.Generic.ArraySortHelper
1.SwapIfGreaterWithItems(T[] keys, IComparer
1 di confronto, Int32 una, Int32 b) a System.Collections.Generic.ArraySortHelper1.QuickSort(T[] keys, Int32 left, Int32 right, IComparer
1 di confronto) a System.Collections.Generic.GenericArraySortHelper1.Sort(T[] keys, Int32 index, Int32 length, IComparer
1 di confronto) il tipo della prima autorizzazione che non è riuscito è stato: System.Security.Permissions.SecurityPermission la Zona del gruppo che non è riuscito era: MyComputer --- Fine dell'analisi dello stack eccezione interna --- in System.Collections.Generic.GenericArraySortHelper1.Sort(T[] keys, Int32 index, Int32 length, IComparer
1 di confronto) a System.Array.Sort [T] (T [] matrice, indice Int32, Int32 lunghezza, IComparer1 comparer) at System.Array.Sort[T](T[] array, IComparer
1 di confronto) a Nukeville.Modules .SkinLab.View.GetNVFolder (String ParentName, String [] CF) a Nukeville.Modules.SkinLab.View.GetJavaFolderArrays (String RootPath) a Nukeville.Modules.SkinLab.View.Page_PreRender (Object s, Ev entArgs e) a System.Web.UI.Control.OnPreRender (EventArgs) A System.Web.UI.Control.PreRenderRecursiveInternal () a System.Web.UI.Control.PreRenderRecursiveInternal () a System.Web.UI.Control. PreRenderRecursiveInternal () a System.Web.UI.Control.PreRenderRecursiveInternal () a System.Web.UI.Control.PreRenderRecursiveInternal () a System.Web.UI.Control.PreRenderRecursiveInternal () a System.Web.UI.Control.PreRenderRecursiveInternal ( ) a System.Web.UI.Control.PreRenderRecursiveInternal () a System.Web.UI.Control.PreRenderRecursiveInternal () a System.Web.UI.Control.PreRenderRecursiveInternal () in System.Web.UI.Page.ProcessRequestMain (booleano includeStagesBeforeAsyncPoint , booleano includeStagesAfterAsyncPoint) --- Fine dell'analisi dello stack eccezione interna ---
Soluzione
E 'una questione di sicurezza. Non è possibile P / Invoke StrCmpLogicalW () da un attendibilità parziale ambiente ASP.NET.