A person got this error, seems to be very rare and I cant really figure out why it appeared.
Application: K2HGame.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at SFML.Graphics.Text.sfRenderTexture_drawText(IntPtr, IntPtr, MarshalData ByRef)
at SFML.Graphics.Text.Draw(SFML.Graphics.RenderTarget, SFML.Graphics.RenderStates)
at SFML.Graphics.RenderTexture.Draw(SFML.Graphics.Drawable)
at K2HGame.SFML_Utils+RenderSurface.Draw(SFML.Graphics.Drawable ByRef)
at K2HGame.SFML_Utils.DrawText(RenderSurface, System.String, Int32, Int32, Int32 ByRef, UInt32)
at K2HGame.modText.DrawText(Int32, System.Object, System.Object, System.String, Int32 ByRef, UInt32)
at K2HGame.modPlayer.BltPlayerName(Int32)
at K2HGame.GameLoop.Start()
at K2HGame.DataHandlerPlayer+_Closure$28-0._Lambda$0()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
Code that it occured in:
Public Shared Sub DrawText(surface As RenderSurface, text As String, x As Integer, y As Integer, ByRef color As Integer, Optional fontSize As UInteger = 13)
Try
If surface.Font Is Nothing Then
Return
End If
Dim output As New SFML.Graphics.Text(text, surface.Font, fontSize)
'Dim red As Byte = color >> 16 And 255
'Dim green As Byte = color >> 8 And 255
'Dim blue As Byte = color And 255
Dim convColor = ColorTranslator.FromOle(color)
'Outline
output.Color = New SFML.Graphics.Color(0, 0, 0)
output.Position = New SFML.System.Vector2f(x + 1, y)
surface.Draw(output)
output.Position = New SFML.System.Vector2f(x, y + 1)
surface.Draw(output)
output.Position = New SFML.System.Vector2f(x - 1, y)
surface.Draw(output)
output.Position = New SFML.System.Vector2f(x, y - 1)
surface.Draw(output)
'Text
output.Position = New SFML.System.Vector2f(x, y)
output.Color = New SFML.Graphics.Color(convColor.R, convColor.G, convColor.B)
surface.Draw(output)
output.Dispose()
Catch ex As Exception
MainHandler.LogException("DrawText", ex)
End Try
End Sub
Public Sub Clear()
Try
renderTexture.Clear(backGroundColor)
Catch ex As Exception
MainHandler.LogException("Clear", ex)
End Try
End Sub
Public Sub Draw(ByRef drawable As Graphics.Drawable)
Try
If Not isRendering Then
Clear()
isRendering = True
End If
renderTexture.Draw(drawable)
Catch ex As Exception
MainHandler.LogException("Draw", ex)
End Try
End Sub
Any ideas are appreciated!