我创建了一个数组排序器来对 DNN 模块中的 Win Explorer 中的数组进行排序。如对预览问题的回答:
对文件夹名称的数组进行排序,如 Windows Explorer(按数字和字母顺序) - VB.NET
用户在运行模块时会收到以下错误(如下),我不是特别经验丰富的 ASP.NET 开发人员。是否因为我在 IComparer 中使用了StrCmpLogicalW并且正在不支持 StrCmpLogicalW 的平台上使用而导致此错误。还是因为权限问题造成的。
任何帮助都非常感谢,
非常感谢。
这是导致错误的分拣机。
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
这是异常堆栈跟踪:
InnerException:无法比较数组中的两个元素。
消息:DotNetNuke.Services.Exceptions.PageLoadException:无法比较数组中的两个元素。---|> System.InvalidOperationException:无法比较数组中的两个元素。---|> System.Security.SecurityException: System.Security.Permissions.SecurityPermission at Nukeville.Modules.SkinLab.View.nvSorter.Compare(String x, String y) at System.Collections.Generic.ArraySortHelper
1.SwapIfGreaterWithItems(T[] keys, IComparer
1 比较器,Int32 a , Int32 b) 在 System.Collections.Generic.ArraySortHelper1.QuickSort(T[] keys, Int32 left, Int32 right, IComparer
1 比较器) 在 System.Collections.Generic.GenericArraySortHelper1.Sort(T[] keys, Int32 index, Int32 length, IComparer
1 比较器) 失败的第一个权限的类型是: System.Security.Permissions.SecurityPermission 失败的程序集的区域是:MyComputer --- 内部异常堆栈跟踪结束 --- 在 System.Collections.Generic.GenericArraySortHelper1.Sort(T[] keys, Int32 index, Int32 length, IComparer
1 个比较器)在 System.Array.Sort[T](T[] 数组,Int32 索引,Int32 长度,IComparer1 comparer) at System.Array.Sort[T](T[] array, IComparer
1 个比较器)在 Nukeville.Modules.SkinLab.View.GetJavaFolderArrays(String RootPath) 在 Nukeville.Modules.SkinLab.View.Page_PreRender(Object s,在 System.Web.UI.Control.PreRenderRecursiveInternal() 在 System.Web.UI.Control.PreRenderRecursiveInternal() 在 System.Web.UI.Control 的 System.Web.UI.Control.OnPreRender(EventArgs e) 的 EventArgs e)。 PreRenderRecursiveInternal() 在 System.Web.UI.Control.PreRenderRecursiveInternal() 在 System.Web.UI.Control.PreRenderRecursiveInternal() 在 System.Web.UI.Control.PreRenderRecursiveInternal() 在 System.Web.UI.Control.PreRenderRecursiveInternal() ) 在 System.Web.UI.Control.PreRenderRecursiveInternal() 在 System.Web.UI.Control.PreRenderRecursiveInternal() 在 System.Web.UI.Control.PreRenderRecursiveInternal() 在 System.Web.UI.Page。ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- 内部异常堆栈跟踪结束 ---