I am getting an AccessViolationError with the following code.

vb.net Code:
  1. Sub Blend(PosX As Int32, PosY As Int32)
  2.             GetDrawingDimensions(PosX, PosY)
  3.  
  4.             Data = New BitmapData
  5.             CanvasData = New BitmapData
  6.  
  7.             Select Case True
  8.                 Case Me.X < 0 AndAlso Me.Y < 0
  9.                     Bounds = New Rectangle(Math.Abs(Me.X), Math.Abs(Me.Y), WidthToDraw, HeightToDraw)
  10.                     CanvasBounds = New Rectangle(PosX, PosY, WidthToDraw, HeightToDraw)
  11.                 Case Me.X < 0
  12.                     Bounds = New Rectangle(Math.Abs(Me.X), Y, WidthToDraw, HeightToDraw)
  13.                     CanvasBounds = New Rectangle(PosX, Y + PosY, WidthToDraw, HeightToDraw)
  14.                 Case Me.Y < 0
  15.                     Bounds = New Rectangle(X, Math.Abs(Me.Y), WidthToDraw, HeightToDraw)
  16.                     CanvasBounds = New Rectangle(X + PosX, PosY, WidthToDraw, HeightToDraw)
  17.                 Case Else
  18.                     Bounds = New Rectangle(X, Y, WidthToDraw, HeightToDraw)
  19.                     CanvasBounds = New Rectangle(X + PosX, Y + PosY, WidthToDraw, HeightToDraw)
  20.             End Select
  21.  
  22.             Data = TiledImage.LockBits(Bounds, ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb)
  23.             CanvasData = bmpCanvas.LockBits(CanvasBounds, ImageLockMode.ReadWrite, PixelFormat.Format32bppPArgb)
  24.             For y As Int32 = 0 To HeightToDraw - 1
  25.                 For x As Int32 = 0 To WidthToDraw - 1
  26.  
  27.                     C1 = Color.FromArgb(Marshal.ReadInt32(Data.Scan0, (Data.Stride * y) + (4 * x)))
  28.                     C2 = Color.FromArgb(Marshal.ReadInt32(CanvasData.Scan0, (CanvasData.Stride * (y + Me.Y)) + (4 * (x + Me.X))))
  29.  
  30.                     If Not C1.ToArgb = Alpha.ToArgb Then
  31.  
  32.                         R1 = wA * (C1.R / 8) : G1 = wA * (C1.G / 8) : B1 = wA * (C1.B / 8)
  33.                         R2 = wB * (C2.R / 8) : G2 = wB * (C2.G / 8) : B2 = wB * (C2.B / 8)
  34.  
  35.                         R = Math.Min(31, Math.Floor(R1 + R2)) * 8
  36.                         G = Math.Min(31, Math.Floor(G1 + G2)) * 8
  37.                         B = Math.Min(31, Math.Floor(B1 + B2)) * 8
  38.  
  39.                         Try
  40.                             Marshal.WriteByte(CanvasData.Scan0, (CanvasData.Stride * (y + Me.Y)) + (4 * (x + Me.X)), CByte(B))
  41.                             Marshal.WriteByte(CanvasData.Scan0, (CanvasData.Stride * (y + Me.Y)) + (4 * (x + Me.X)) + 1, CByte(G))
  42.                             Marshal.WriteByte(CanvasData.Scan0, (CanvasData.Stride * (y + Me.Y)) + (4 * (x + Me.X)) + 2, CByte(R))
  43.                         Catch ex As Exception
  44.                             MessageBox.Show(ex.Message)
  45.                         End Try
  46.  
  47.                     End If
  48.                 Next
  49.                 blendProgress.PerformStep(WidthToDraw)
  50.             Next
  51.  
  52.             TiledImage.UnlockBits(Data)
  53.             bmpCanvas.UnlockBits(CanvasData)
  54.         End Sub

The error happens on the line:
vb.net Code:
  1. C2 = Color.FromArgb(Marshal.ReadInt32(CanvasData.Scan0, (CanvasData.Stride * (y + Me.Y)) + (4 * (x + Me.X))))

I have read up on the exception and found out it comes from an invalid pointer. The weird part is the violation only happens sometimes. Even if I put that sub in a loop, it won't happen every pass. Anyone seen another error that may be causing it?