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.
Related
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!
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 have Sitecore instance 6.6 updated from 6.3. After the update an exception occurs when right-clicking on the left side of the content tree. That's the space where you can choose to show the lock icon and so on. Here's a screenshot:
This is the error message:
[ArgumentException: Empty strings are not allowed.
Parametername: header]
Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName) +241
Sitecore.Web.UI.HtmlControls.Menu.Add(String id, String header, String icon, String hotkey, String click, Boolean check, String radiogroup, MenuItemType type) +68
Sitecore.Shell.Applications.ContentManager.ContentEditorForm.Gutter_ContextMenu() +637
[TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +808
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
Sitecore.Shell.Framework.Commands.MethodCommandProcessor.Invoke(PipelineArgs args) +427
Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline) +330
Sitecore.Pipelines.Pipeline.DoStart(PipelineArgs args) +208
Sitecore.Pipelines.Pipeline.Start(PipelineArgs args, Boolean atomic) +182
Sitecore.Shell.Framework.Commands.MethodCommand.Execute(CommandContext context) +499
Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +530
Sitecore.Shell.Applications.ContentManager.ContentEditorPage.OnPreRender(EventArgs e) +25
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
Any idea how I can fix this?
There's a couple of things you need to check and doublecheck.
1) Is your Sitecore.Kernel.dll in /bin the correct version for 6.6. A very common mistake to make is, to go through the upgrade fine and then rebuild your project - forgetting that your local obj and bin folders hold Sitecore DLLs for 6.3 that then gets copied to /bin.
To fix this, first try and take the entire /bin directory from your 6.6 zip and copy/replace it to your website /bin. See if the issues goes away.
2) If not, check our commands.config (located in App_Config/Include) and make sure it's the right version for 6.6.
These two, is where I would start looking first.
I found out what caused this error. The items in the core database of that menu lost their language versions during the update. After creating the language versions of those items in the core db, the menu shows up again.
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.