I've been trying to get a build archived for IOS by using Visual studio and the "Pair to mac" functionality.
However, when I try and do a release build, I get this error:
Error processing the method 'System.Void ProjectName.iOS.Renderers.IOSWebViewRenderer::.ctor()' in the assembly 'TextFlowMobile.iOS.exe': Object reference not set to an instance of an object TextFlowMobile.iOS
My code for this renderer, that is for WKWebView is as follows:
namespace TextFlowMobile.iOS.Renderers
{
public class IOSWebViewRenderer : WkWebViewRenderer
{
public override WKNavigation LoadHtmlString(NSString htmlString, NSUrl baseUrl)
{
try
{
if(htmlString != null && baseUrl != null)
{
// Add additional HTML to ensure fonts scale correctly and don't appear extremely small and almost unreadable
var iOSHtmlWithScaling = htmlString.ToString().Insert(0, "<meta name='viewport' content='width=device-width,initial-scale=1,maximum-scale=1' />");
return base.LoadHtmlString((NSString)iOSHtmlWithScaling, baseUrl);
}
else
{
return base.LoadHtmlString(htmlString, baseUrl);
}
}
catch (Exception)
{
//System.Diagnostics.Debug.WriteLine(ex);
return base.LoadHtmlString(htmlString, baseUrl);
}
}
}
}
As you can see, I don't override the constructor at all. I really don't see why this happens, especially since it builds (and deploys on a simulator on the connected mac) perfectly fine for debug.
My current config is Release | iPhone | ProjectName.iOS | Remote Device
I really appreciate any help!
This error occurred because I had an Obfuscator running on the release version of the code. When I tried to archive this, I imagine it couldn't properly compile this renderer because it was obfuscated.
Related
I have a java project using jdk11. I need to migrate the project to java 17 but integration tests have started failing. As soon as I upgraded to JDK17 I started getting below error:
java.lang.reflect.InaccessibleObjectException: Unable to make private sun.reflect.generics.repository.FieldRepository java.lang.reflect.Field.getGenericInfo() accessible: module java.base does not "opens java.lang.reflect" to unnamed module #5702b3b1
I was also getting error for java.util but that is fixed using below command line code.
I have tried adding the command line options as below but the tests are still failing
<argLine>
--illegal-access=permit
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/sun.reflect=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
</argLine>
Any help is appreciated.
You can pass your method in to this:
public static <T extends AccessibleObject> T forceAccessible(T o) {
try {
Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
unsafeField.setAccessible(true);
Unsafe unsafe = (Unsafe) unsafeField.get(null);
Method m = Class.class.getDeclaredMethod("getDeclaredFields0", boolean.class);
m.setAccessible(true);
Field override = ((Field[]) m.invoke(AccessibleObject.class, false))[0];
if (!o.isAccessible()) {
try {
o.setAccessible(true);
} catch (InaccessibleObjectException e) {
unsafe.putBoolean(o, unsafe.objectFieldOffset(override), true);
}
}
} catch (Exception e) {}
return o;
}
If you are running Start Foreground from an Android.App service
I get an error when I start Zxing (barcode reading).
Error details: Compatible code is not running.
Selective debug execution may or may not be the executable code running in the current thread.
Unhandled Exception:
Java.Lang.NullPointerException: <Timeout exceeded getting exception details>
Is there anyone who can solve this problem?
-- 2020/12/22 add --
Thank you for your reply.
I thought I'd ask a simple question,
It seems that it was not concise but vague Excuse me.
Execute background service to acquire location information continuously (every 15 minutes)
I want to read barcodes as another function,
An error will occur if the barcode is read while the background service is running.
It would be ideal if there was a way to avoid an error in this situation, but I don't know how to deal with it.
Exit background service, read barcode, then
I was wondering if I could handle it by restarting the background service.
I can't solve the problem.
1. Refer to the url below to get the location information in the background.
https://teratail.com/questions/167858
Package installation
ZXing.Net.Mobile (2.4.1)
ZXing.Net.Mobile.Forms (2.4.1)
Run the Clicked event on the Xamarin.Forms Button
The code below calls the Zxing form.
await Navigation.PushAsync (new QRScanPage ()); ← * An error occurs here
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
public partial class QRScanPage: ContentPage
{
public Page00_QRScanPage ()
{
InitializeComponent ();
}
void Handle_OnScanResult (ZXing.Result result)
{
Device.BeginInvokeOnMainThread (async () =>
{
zxing.IsAnalyzing = false;
await Navigation.PopAsync ();
await DisplayAlert ("notification", "Read the following value:" + result.Text, "OK");
zxing.IsAnalyzing = true;
});
}
protected override void OnAppearing ()
{
try
{
base.OnAppearing ();
zxing.IsScanning = true;
}
catch (Exception ex)
{
DisplayAlert ("ExErr",
$ "{ex.Message}", Msg.Button.Ok);
}
}
protected override void OnDisappearing ()
{
zxing.IsScanning = false;
base.OnDisappearing ();
}
}
Service outage
Intent serviceIntent = new Intent (this, typeof (BackgroundService)); * "BackgroundService" is the running Service class
Base.StopService (serviceIntent);
Stop with StopSelf () method
As a result, nothing could be solved.
Have a Xamarin forms project and trying to hook in NFC reading to the app. Currently plumbing in the iOS native side of things. I've setup all the provisioning and options on the apple portal side of things and i've added the following to the entitlements:
<dict>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>NDEF</string>
</array>
</dict>
Also added to the info.plist:
<key>NFCReaderUsageDescription</key>
<string>NFC tag to read NDEF messages into the application</string>
The code i've got for my native dependency for iOS is as follows:
[assembly: Dependency(typeof(RFIDScannerHelper))]
namespace MyProject.Mobile.Platform.iOS
{
public class RFIDScannerHelper : IRFIDScannerHelper
{
public bool hasRFID()
{
return true;
}
NFCNdefReaderSession Session;
public void ScanRFID(Action<string> act, VisualElement el)
{
NFChecker nfchecker = new NFChecker();
Session = new NFCNdefReaderSession(nfchecker, null, false);
Session?.BeginSession();
}
}
public class NFChecker : NSObject, INFCNdefReaderSessionDelegate
{
public Action<string> nfcFoundAction;
public void DidDetect(NFCNdefReaderSession session, NFCNdefMessage[] messages)
{
foreach (NFCNdefMessage msg in messages)
{
if (msg.Records.Count() > 0)
{
nfcFoundAction.Invoke(new NSString(msg.Records[0].Payload, NSStringEncoding.UTF8));
}
}
}
public void DidInvalidate(NFCNdefReaderSession session, NSError error)
{
var readerError = (NFCReaderError)(long)error.Code;
if (readerError != NFCReaderError.ReaderSessionInvalidationErrorFirstNDEFTagRead &&
readerError != NFCReaderError.ReaderSessionInvalidationErrorUserCanceled)
{
}
}
}
}
When this runs it all seems to fire correctly but on start of session it goes straight to the DidInvalidate method in the ReaderDelegate and the error says "Session is invalidated unexpectedly".
Can anyone tell me what I could be missing out?
UPDATE
I've also tried the xamarin provided sample here. But I also receive the exact same error "Session is invalidated unexpectedly". I've mucked around with our provisioning but no combination changes this error. Has anyone even got the xamarin sample to work?
#matt, it's a Visual Studio 2019 error. You should select the Entitlements.plist in your project settings, but you are not able because the "entry" where you should insert the path is always disabled. I have reported the problem
https://developercommunity.visualstudio.com/content/problem/752711/xamarinios-i-cant-set-entitlements.html
Have a WPF app that I am converting to ASP.net and I am having issues with SAP.
When I run this line I get an exception.
RfcDestinationManager.RegisterDestinationConfiguration(Backend);
Exception Message {"exePath must be specified when not running inside a stand alone exe."}
Stack Trace
at System.Configuration.ConfigurationManager.OpenExeConfigurationImpl(ConfigurationFileMap fileMap, Boolean isMachine, ConfigurationUserLevel userLevel, String exePath, Boolean preLoad)
at System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel userLevel)
at SAP.Middleware.Connector.RfcConfigParameters..cctor()
googling around I saw as similar issue here exePath must be specified when not running inside a stand alone exe
The issue seems to be using ConfigurationManager.OpenExeConfiguration rather that System.Web.Configuration.WebConfigurationManagerwhich is what I need to use. Problem is I can't change that as its part of the SAP.Net Connector.
Is there anything I can do?
Edit: My BackendConfig code
public class BackendConfig : IDestinationConfiguration
{
public RfcConfigParameters GetParameters(String destinationName)
{
if ("P38".Equals(destinationName))
{
var parms = new RfcConfigParameters
{
{RfcConfigParameters.AppServerHost, "SAPSERVER"},
{RfcConfigParameters.SystemNumber, "86"},
{RfcConfigParameters.SncMode, "1"},
{RfcConfigParameters.SncPartnerName, "p:SAP#SERVER"},
{RfcConfigParameters.Client, "010"},
{RfcConfigParameters.Language, "EN"},
{RfcConfigParameters.PoolSize, "5"}
};
return parms;
}
else return null;
}
// The following two are not used in this example:
public bool ChangeEventsSupported()
{
return false;
}
public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;
}
I am coding this:
IdentityResult result = new IdentityResult("Username not found");
I can see this is one of the constructors in here;
namespace Microsoft.AspNet.Identity
{
//
// Summary:
// Represents the result of an identity operation
public class IdentityResult
{
//
// Summary:
// Failure constructor that takes error messages
//
// Parameters:
// errors:
public IdentityResult(IEnumerable<string> errors);
//
// Summary:
// Failure constructor that takes error messages
//
// Parameters:
// errors:
public IdentityResult(params string[] errors);
//
// Summary:
// Constructor that takes whether the result is successful
//
// Parameters:
// success:
protected IdentityResult(bool success);
But I can't find the source code for this. Is the source code available?
You can easily download the source code from the Github repository (future releases and beta) or CodePlex (for older versions) since ASP.NET Identity (and a lot of other parts of ASP.NET) are open source nowadays.
Visual Studio only knows the outline of a class when the action source isn't available on the machine itself (hence you get this view when clicking F12).
you can use telerik decompiler its free
http://www.telerik.com/products/decompiler.aspx
try to search class on this as well.
http://dotnetframework.org/Search.aspx