I have the following problem and do not get on with the debug. I have a FiveM server in Docker container.
There I get at the moment often the error
[NM] SocketReceiveThread error: System.Security.Cryptography.CryptographicException: Bad PKCS7 padding. Invalid length 0.
at Mono.Security.Cryptography.SymmetricTransform.ThrowBadPaddingException (System.Security.Cryptography.PaddingMode padding, System.Int32 length, System.Int32 position) [0x00056] in <9391d7651e69459eae268d8a1dfa670f>:0
at Mono.Security.Cryptography.SymmetricTransform.FinalDecrypt (System.Byte[] inputBuffer, System.Int32 inputOffset, System.Int32 inputCount) [0x00146] in <9391d7651e69459eae268d8a1dfa670f>:0
at Mono.Security.Cryptography.SymmetricTransform.TransformFinalBlock (System.Byte[] inputBuffer, System.Int32 inputOffset, System.Int32 inputCount) [0x0002e] in <9391d7651e69459eae268d8a1dfa670f>:0
at Module.FortniteDiesDas. (System.Security.Cryptography.ICryptoTransform , System.Byte[] , System.Int32 , System.Int32 ) [0x00000] in <5ca8538a957947daa4563d25c9782ef1>:0
at Module.FortniteDiesDas.ProcessInboundPacket (System.Net.IPEndPoint endPoint, System.Byte[]& data, System.Int32& offset, System.Int32& length) [0x00076] in <5ca8538a957947daa4563d25c9782ef1>:0
at LiteNetLib.NetManager.DataReceived (LiteNetLib.NetPacket packet, System.Net.IPEndPoint remoteEndPoint) [0x000bc] in <123b012ebafb4637be4274b2a7090bf6>:0
at LiteNetLib.NetManager.OnMessageReceived (LiteNetLib.NetPacket packet, System.Net.Sockets.SocketError errorCode, System.Net.IPEndPoint remoteEndPoint) [0x0002e] in <123b012ebafb4637be4274b2a7090bf6>:0
Unfortunately, I now have no idea why this comes, the advanced debug mode does not help.
Therefore I hope for the knowledge of the community.
Thank you very much!
Related
open System.Drawing
let bitmap = new Bitmap(16,16)
let path = __SOURCE_DIRECTORY__
bitmap.Save(path+"bitmap.png")
I wrote the code above to save a instantiated Bitmap into the project folder. I got a Generic Error when I ran the code. The whole bunch of error messages is as below.
System.Exception: Generic Error [GDI+ status: GenericError]
at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x00079] in :0
at System.Drawing.Image.Save (System.String filename, System.Drawing.Imaging.ImageCodecInfo encoder, System.Drawing.Imaging.EncoderParameters encoderParams) [0x0003d] in :0
at System.Drawing.Image.Save (System.String filename, System.Drawing.Imaging.ImageFormat format) [0x00044] in :0
at System.Drawing.Image.Save (System.String filename) [0x00008] in :0
at (wrapper remoting-invoke-with-check) System.Drawing.Image:Save (string)
at .$FSI_0037.main# () [0x00006] in <4081182357644f828a64898ac573806b>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in :0
I debugged the code and figured out the following things.
the line of code to create a Bitmap worked fine
the path in this situation was "/"
the code was fine before the Save() function was called
I just started to learn F# and cannot figure out the problem. Could anyone help with this?
The problem came from the value of the "SOURCE_DIRECTORY" of the code.
In most cases, the value of SOURCE_DIRECTORY does not contain a '/' at the end of it. So the last line of code can be changed to the code below.
bitmap.Save(path+"/bitmap.png")
I my case, the value of SOURCE_DIRECTORY is a single "/". Although I still haven't figured out why, the problem described can be solved by specifying an existing directory with the filename in the bitmap save function.
I've created a Xamarin.forms project and I've created DataTemplateSelector which is working fine in iOS but in Andoird, when I scroll faster app don't crash but when I scroll slower the app crashes and TargetInvocationException comes. I'm not even able to track the error and its the choice of error when it wants to come, sometimes it don't crash with same data either scroll faster or slower and sometimes it immediately crashes with the same data when we try to scroll a little bit.
I've logged the error and below is the error in log:
Time: 12/14/2016 1:37:48 PM
Error: Unhandled Exception
System.Exception: CurrentDomainOnUnhandledException ---> Java.Lang.RuntimeException: java.lang.reflect.InvocationTargetException ---> Java.Lang.Reflect.InvocationTargetException: Exception of type 'Java.Lang.Reflect.InvocationTargetException' was thrown. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00011] in <368820a9888f43ddb85d18e87189adbf>:0
at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <368820a9888f43ddb85d18e87189adbf>:0
at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x0000c] in <368820a9888f43ddb85d18e87189adbf>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <368820a9888f43ddb85d18e87189adbf>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00056] in <368820a9888f43ddb85d18e87189adbf>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <368820a9888f43ddb85d18e87189adbf>:0
at Xamarin.Forms.BindingExpression+BindingExpressionPart.TryGetValue (System.Object source, System.Object& value) [0x00026] in <7b0368eb3d0f405da776a09e3171532a>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <368820a9888f43ddb85d18e87189adbf>:0
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x000a8] in <a043032cf94a485190047a14918b9f60>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00068] in <a043032cf94a485190047a14918b9f60>:0
at Android.Views.View.DispatchTouchEvent (Android.Views.MotionEvent e) [0x00036] in <206240d88f7f44d795aacbc1d5348a1f>:0
at Xamarin.Forms.Platform.Android.PlatformRenderer.DispatchTouchEvent (Android.Views.MotionEvent e) [0x00035] in <d572ae0ccf89437fad1de1370c623a06>:0
at Android.Views.View.n_DispatchTouchEvent_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) [0x00011] in <206240d88f7f44d795aacbc1d5348a1f>:0
at (wrapper dynamic-method) System.Object:035bfbdb-dd96-451c-b894-4f2fd770769d (intptr,intptr,intptr)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
Below is the code of xaml.cs file
http://pastebin.com/UvyxMwtP
Below is the code of xaml file
http://pastebin.com/VVfKAjnn
Below is the code of DataTemplateSelector
http://pastebin.com/nn2dGZAW
Below are the code of templates:
http://pastebin.com/0mJD1gJ1
http://pastebin.com/uJiLnBKK
http://pastebin.com/gcj2TuJ1
http://pastebin.com/c8TByW1z
http://pastebin.com/ww51B4Su
I've started to convert our Unity/iOS game to save state with Protobuf-net. It looked like things were working OK, until I added this instance variable to GameState
[ProtoMember(10)]
public List<Unit> fUnits;
Unit is
[ProtoContract]
[ProtoInclude(21, typeof(ArtilleryUnit))]
[ProtoInclude(22, typeof(CavalryArtilleryUnit))]
[ProtoInclude(23, typeof(CavalryUnit))]
[ProtoInclude(24, typeof(InfantryUnit))]
[Serializable]
public class Unit : IActionHandler
This is the first subclass I've serialized. I'm testing my code by deserializing right after writing
using (Stream memoryStream = new MemoryStream()) {
byte[] data = System.Text.Encoding.UTF8.GetBytes(readText);
memoryStream.Write(data, 0, data.Length);
memoryStream.Position = 0;
WBTSSerializer deserializer = new WBTSSerializer();
testState = new GameState();
deserializer.Deserialize(memoryStream, testState, typeof(GameState));
}
and I get
ProtoBuf.ProtoException: Invalid wire-type; this usually means you have over-written a file without truncating or setting the length; see http://stackoverflow.com/q/2152978/23354
at ProtoBuf.ProtoReader.SkipField () [0x00000] in <filename unknown>:0
at WBTSSerializer.Read (wbts.Unit , ProtoBuf.ProtoReader ) [0x00000] in <filename unknown>:0
at WBTSSerializer.Read (wbts.GameState , ProtoBuf.ProtoReader ) [0x00000] in <filename unknown>:0
at WBTSSerializer.Deserialize (Int32 , System.Object , ProtoBuf.ProtoReader ) [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.DeserializeCore (ProtoBuf.ProtoReader reader, System.Type type, System.Object value, Boolean noAutoCreate) [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream source, System.Object value, System.Type type, ProtoBuf.SerializationContext context) [0x00000] in <filename unknown>:0
at ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream source, System.Object value, System.Type type) [0x00000] in <filename unknown>:0
at wbts.Game.SaveGame (System.String filename) [0x000c1] in /Users/david/Shenandoah/WBTS/wbts/wbts/Game.cs:620
Needless to say, I've checked for overwriting (it's a brand new file). And, if I take out the ProtoMember(10), it won't throw.
If I take out the ProtoInclude lines, I get an error about the subclasses. And, if I take out ProtoMember within Unit, it still throws.
If it matters, I am currently just running this from Xamarin (on Mac OS X — I'm an iOS developer). But that's just for ease of testing, I have managed to hit Protobuf-net with enough sticks to make it run on an iPad.
My eye is drawn immediately to:
byte[] data = System.Text.Encoding.UTF8.GetBytes(readText);
Protobuf data is not text, and is not UTF-8 (although strings inside protobuf data are UTF-8, by coincidence) - therefore "decoding" it (wrong word, really) via UTF8 will guarantee you corrupt data. The preferred way to deal with protobuf data is as binary - for example, a byte[] - much like you would with image data etc. However, if you are required to store or transport it in a text form, then Convert.ToBase64String and Convert.FromBase64String are appropriate mechanisms to translate between text and binary. Please see the first section of How many ways can you mess up IO? for more information.
I decided to move my application from Android to iOS. Application use libgdx library. I generated ios subproject using libgdx and opened it using Xamarin Studio. All images are linked from my-project-android/assets/data. All images have set build Action > content. Now every time when run project from xamarin studio i get GdxRuntimeException Coldn't load file: data/background.png. This file is the first image which i load in my application.
All operation i have done on my mac both with simulator and iPhone device.
StackTrace:
com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: /data/background.png ---> System.Exception: unknown protocol: file
at java.net.URL..ctor (java.net.URL context, System.String spec, java.net.URLStreamHandler handler) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at com.badlogic.gdx.graphics.Pixmap..ctor (com.badlogic.gdx.files.FileHandle file) [0x0004c] in /Users/badlogic/jenkins/workspace/libgdx-mac/gdx/src/com/badlogic/gdx/graphics/Pixmap.java:140
at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare () [0x00052] in /Users/badlogic/jenkins/workspace/libgdx-mac/gdx/src/com/badlogic/gdx/graphics/glutils/FileTextureData.java:64
at com.badlogic.gdx.graphics.Texture.load (TextureData data) [0x00036] in /Users/badlogic/jenkins/workspace/libgdx-mac/gdx/src/com/badlogic/gdx/graphics/Texture.java:175
at com.badlogic.gdx.graphics.Texture.create (TextureData data) [0x0000d] in /Users/badlogic/jenkins/workspace/libgdx-mac/gdx/src/com/badlogic/gdx/graphics/Texture.java:159
at com.badlogic.gdx.graphics.Texture..ctor (com.badlogic.gdx.files.FileHandle file, com.badlogic.gdx.graphics.Format format, Boolean useMipMaps) [0x00060] in /Users/badlogic/jenkins/workspace/libgdx-mac/gdx/src/com/badlogic/gdx/graphics/Texture.java:133
at com.badlogic.gdx.graphics.Texture..ctor (com.badlogic.gdx.files.FileHandle file) [0x00001] in /Users/badlogic/jenkins/workspace/libgdx-mac/gdx/src/com/badlogic/gdx/graphics/Texture.java:122
at com.kaproel.trafficControlManager.MainMenuScreen..ctor (com.kaproel.trafficControlManager.trafficControl game) [0x00088] in /Users/Piotr/Developer/mono-iOS/trafficControl/src/com/kaproel/trafficControlManager/MainMenuScreen.java:64
at com.kaproel.trafficControlManager.trafficControl.create () [0x00024] in /Users/Piotr/Developer/mono-iOS/trafficControl/src/com/kaproel/trafficControlManager/trafficControl.java:32
at com.badlogic.gdx.backends.ios.IOSGraphics.OnLoad (System.EventArgs arg0) [0x00010] in /Users/badlogic/jenkins/workspace/libgdx-mac/backends/gdx-backend-iosmonotouch/src/com/badlogic/gdx/backends/ios/IOSGraphics.java:133
at OpenTK.Platform.iPhoneOS.iPhoneOSGameView.RunWithFrameInterval (Int32 frameInterval) [0x00041] in /Developer/MonoTouch/Source/monotouch/src/OpenGLES/OpenTK_1.0/Platform/iPhoneOS/iPhoneOSGameView.cs:694
at OpenTK.Platform.iPhoneOS.iPhoneOSGameView.Run () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/OpenGLES/OpenTK_1.0/Platform/iPhoneOS/iPhoneOSGameView.cs:652
at com.badlogic.gdx.backends.ios.IOSApplication.FinishedLaunching (MonoTouch.UIKit.UIApplication uiApp, MonoTouch.Foundation.NSDictionary options) [0x0023e] in /Users/badlogic/jenkins/workspace/libgdx-mac/backends/gdx-backend-iosmonotouch/src/com/badlogic/gdx/backends/ios/IOSApplication.java:166
at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at com.kaproel.trafficControlManager.Application.Main (System.String[] args) [0x00000] in /Users/Piotr/Developer/mono-iOS/trafficControl-ios/Main.cs:33
Please give me same idea of solution
Snipe of code:
public MainMenuScreen(final trafficControl game) {
this.game = game;
this.stage = new Stage(0, 0,true);
batch = new SpriteBatch();
this.camera = new OrthographicCamera();
this.camera.setToOrtho(false, 800, 480);
texture = new Texture(Gdx.files.local("data/background.png")); // <!-- this line make runtime error
its might be a problem of png optimization. Have you check this link
http://code.google.com/p/libgdx/wiki/IOSWIP
Read PNG optimization in this page. Might be that will help you.
We are concurrently developing Android and iPhone apps and the core code (written in C#) is shared between them. The SQLite database initialization code, for example, is the same in both apps with only slight variations to accommodate the file structure on each platform. The following code is working in MonoTouch, but throws an EntryPointNotFoundException in Mono for Android:
try
{
System.Data.Common.DbDataAdapter adapter = new SqliteDataAdapter(selectCommand);
retVal = adapter.Fill(dataSet);
}
catch (Exception exception)
{
...
}
As far as I can tell, the selectCommand and dataSet objects are identical on both platforms The message and stack trace are as follows:
> System.EntryPointNotFoundException: sqlite3_column_origin_name at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods:sqlite3_column_origin_name (intptr,int)
at Mono.Data.Sqlite.SQLite3.ColumnOriginalName (Mono.Data.Sqlite.SqliteStatement stmt, Int32 index) [0x00000] in /home/jon/Development/xamarin/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs:493
at Mono.Data.Sqlite.SqliteDataReader.GetSchemaTable (Boolean wantUniqueInfo, Boolean wantDefaultValue) [0x0042d] in /home/jon/Development/xamarin/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDa>taReader.cs:619
at Mono.Data.Sqlite.SqliteDataReader.GetSchemaTable () [0x00000] in /home/jon/Development/xamarin/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs:550
at System.Data.Common.DataAdapter.BuildSchema (IDataReader reader, System.Data.DataTable table, SchemaType schemaType, MissingSchemaAction missingSchAction, MissingMappingAction missingMapAction, System.Data.Common.DataTableMappingCollection dtMapping) [0x0003b] in /home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data.Common/DataAdapter.cs:284
at System.Data.Common.DataAdapter.BuildSchema (IDataReader reader, System.Data.DataTable table, SchemaType schemaType) [0x00000] in /home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data.Common/DataAdapter.cs:257
at System.Data.Common.DataAdapter.FillTable (System.Data.DataTable dataTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, System.Int32& counter) [0x00011] in /home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data.Common/DataAdapter.cs:428
at System.Data.Common.DataAdapter.FillInternal (System.Data.DataSet dataSet, System.String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) [0x0009b] in /home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data.Common/DataAdapter.cs:533
at System.Data.Common.DataAdapter.Fill (System.Data.DataSet dataSet, System.String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) [0x00000] in /home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data.Common/DataAdapter.cs:589
at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet, Int32 startRecord, Int32 maxRecords, System.String srcTable, IDbCommand command, CommandBehavior behavior) [0x0004e] in /home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:337
at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet) [0x00000] in /home/jon/Development/xamarin/mono/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:265
at Core.Database.ServerCommunicate.FillDataSet (Core.Database.XCommand selectCommand, System.Data.DataSet& dataSet) [0x00013] in /Users/sstream6/sd/110/core/Asm/Db/Database/Server.cs:648
I have verified on both platforms that the database has been created and a connection established. Has anyone else experienced similar problems?
Unfortunately Android's SQLite library doesn't include support for the sqlite3_column_origin_name() method, so any parts of Mono.Data.Sqlite that depend on it are going to fail. Xamarin has a bug tracked here for modifying the implementation to get around the limitation, but there's no timeframe on it yet as far as I know.