MapSuite Team,
I had previously brought this exception to your attention under the following thread:
thinkgeo.com/forums/MapSuite…fault.aspx
In that thread you had advised that a ‘multi-Raster Layer’ be incorporated to avoid this exception.
In attempting to construct the x/y coordinate index for a MrSid Multi-RasterLayer this same AccessViolationException is encountered. A code-snippet that shows how the MrSid is opened and closed is below.
There appears to be no way out of this exception when needing to open multiple MrSid’s.
The last MapSuite Version that I was able to open multiple MrSid’s was V7. Opening multiple MrSid’s in V8 also did not work and at the time the MapSuite Team advised to continue to use the GeoRasterX86 dll’s from V7 and that this would be fixed in V9.
Is there a fix for this exception?
Appreciate your assistance with this issue.
Dennis
// format Raster Catalog Line for MrSid Raster
private
static
Boolean BuildRasterCatalogLineMrSid(
string
TheFile,
out
string
TheRasterCatalogLine)
{
string
sInform;
RectangleShape TheBoundingBox;
MrSidRasterLayer TheRasterLayer;
// initializations
TheRasterCatalogLine =
string
.Empty;
TheRasterLayer =
new
MrSidRasterLayer(TheFile);
try
{
TheRasterLayer.Open();
}
catch
(Exception ex)
{
sInform = String.Format(
“Unable to Open GeoTiffRasterLayer{0}File={1}{2}Message={3}”
, Environment.NewLine, TheFile, Environment.NewLine, ex.Message);
System.Windows.MessageBox.Show(sInform,
“BuildRasterCatalogLineMrSid”
, System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
return
(
false
);
}
TheBoundingBox = TheRasterLayer.GetBoundingBox();
TheRasterLayer.Close();
TheRasterLayer.Dispose();
TheRasterCatalogLine =
string
.Format(
"{0}, {1}, {2}, {3}, {4}"
, TheBoundingBox.UpperLeftPoint.X, TheBoundingBox.LowerRightPoint.X, TheBoundingBox.UpperLeftPoint.Y, TheBoundingBox.LowerRightPoint.Y, TheFile);
return
(
true
);
}
System.AccessViolationException was unhandled
HResult=-2147467261
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=MapSuiteCore
StackTrace:
at xRM=.2EM=.0hs=(String fileName)
at ThinkGeo.MapSuite.Core.GisImage.8jw=(String filePathName)
at ThinkGeo.MapSuite.Core.MrSidRasterSource.OpenCore()
at ThinkGeo.MapSuite.Core.RasterSource.Open()
at ThinkGeo.MapSuite.Core.RasterLayer.OpenCore()
at ThinkGeo.MapSuite.Core.Layer.Open()
at OriStarRaster.MainWindow.BuildRasterCatalogLineMrSid(String TheFile, String& TheRasterCatalogLine) in C:\OriStarMappingInc\OriStarRaster\MainWindow.xaml.cs:line 495
at OriStarRaster.MainWindow.BuildRasterCatalog(String ThePathOfRasterFiles, String TheDirectoryFileName) in C:\OriStarMappingInc\OriStarRaster\MainWindow.xaml.cs:line 451
at OriStarRaster.MainWindow.butCreateRasterCatalog_Click(Object sender, RoutedEventArgs e) in C:\OriStarMappingInc\OriStarRaster\MainWindow.xaml.cs:line 398
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at OriStarRaster.App.Main() in C:\OriStarMappingInc\OriStarRaster\obj\x86\Release\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: