I thought apt-get install mono-dbg would solve it but i was wrong. How do i get debug information with mono? i am using debian squeeze but couldnt figure it out on debian lenny or etch.
I wrote a dummy program below and i was hoping for a line number but i got this instead. This is a copy/paste from the console/terminal.
Unhandled Exception: System.Exception: nooo blah
at ExceptionTest.Program.func (Int32 a) [0x00000] in <filename unknown>:0
at ExceptionTest.Program.func (Int32 a) [0x00000] in <filename unknown>:0
at ExceptionTest.Program.func (Int32 a) [0x00000] in <filename unknown>:0
at ExceptionTest.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ExceptionTest
{
class Program
{
static void Main(string[] args)
{
func(3);
}
static void func(int a)
{
if (a == 18)
throw new Exception("nooo blah");
func(a + a + 2);
}
}
}
To get file names and line numbers, compile your application with -debug (like gmcs -debug prog.cs) and then run mono --debug prog.exe.
The mono-dbg package gives you debugging symbols for /usr/bin/mono (and libmono).
$ gmcs -debug prog.cs
$ mono --debug prog.exe
Unhandled Exception: System.Exception: nooo blah
at ExceptionTest.Program.func (Int32 a) [0x0001d] in /tmp/prog.cs:19
at ExceptionTest.Program.func (Int32 a) [0x00013] in /tmp/prog.cs:18
at ExceptionTest.Program.func (Int32 a) [0x00013] in /tmp/prog.cs:18
at ExceptionTest.Program.Main (System.String[] args) [0x00000] in /tmp/prog.cs:12
Related
I have a xamarin forms switch , when it is toggled getting the following exception on ios version only:
{System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.SwitchRenderer.OnElementToggled (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\SwitchRenderer.cs:78
at (wrapper delegate-invoke) System.EventHandler`1[Xamarin.Forms.ToggledEventArgs].invoke_void_object_TEventArgs(object,Xamarin.Forms.ToggledEventArgs)
at Xamarin.Forms.Switch+<>c.<.cctor>b__21_0 (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Switch.cs:14
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:343
at Xamarin.Forms.Element.SetValueFromRenderer (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:250
at Xamarin.Forms.Element.Xamarin.Forms.IElementController.SetValueFromRenderer (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:246
at Xamarin.Forms.Platform.iOS.SwitchRenderer.OnControlValueChanged (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\SwitchRenderer.cs:73
at UIKit.UIControlEventProxy.Activated () [0x00004] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIControl.cs:38
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at WeCareMobility.iOS.Application.Main (System.String[] args) [0x00002] in /Users/user/Desktop/Vipin/Copiloto/Mobile/WeCareMobility/WeCareMobility.iOS/Main.cs:20 }
Xaml:
<Switch Grid.Row="0" Grid.Column="1" Margin="{OnPlatform Android='0,0,25,0',iOS='0,0,0,8'}" Scale="{OnPlatform iOS= '0.7'}" VerticalOptions="Start" HorizontalOptions="FillAndExpand" IsToggled="False" Toggled="Switch_Toggled" />
CS:
private void Switch_Toggled(object sender, ToggledEventArgs e)
{
// Perform an action after examining e.Value
if (e.Value)
{
App.Current.MainPage = new NavigationPage(new FlyoutPage());
_weCareStorageService.SetToggleValue(true);
}
}
I do not have any renderer for switch. It is working fine for android.
Upgraded to latest xamarin forms stable version 4.7.0.1080.
Using VS2019 mac. iOS sdk version:13.18.2.1 .
Cleaned,rebuilt. Still crash occurs in ios. Need some help...
Navigation was the issue.Changed navigation like this:
Device.BeginInvokeOnMainThread(() => { App.Current.MainPage = new NavigationPage(new FlyoutPage()); });
Solved issue.
I'm working in a Xamarin app with MVVMCross.
The app works perfectly when I run in debug mode.
But if try to run in release mode it fails with the exception:
Exception masked MvxIoCResolveException: Failed to resolve type
FlexConta.Contracts.Service.IUserService
[mvx] at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.Resolve (System.Type t) [0x00035] in <0da3cbd163cf47a29ec04fff5bb9eecd>:0
[mvx] at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.Resolve[T] () [0x00000] in <0da3cbd163cf47a29ec04fff5bb9eecd>:0
[mvx] at MvvmCross.Platform.Mvx.Resolve[TService] () [0x00005] in <0da3cbd163cf47a29ec04fff5bb9eecd>:0
[mvx] at FlexConta.Core.AppStart.Start (System.Object hint) [0x00000] in <880d0bdc2a5448ffb4d7b35d827753b5>:0
[mvx] at MvvmCross.Droid.Support.V7.AppCompat.MvxSplashScreenAppCompatActivity.TriggerFirstNavigate () [0x00005] in <74631770bbbe4bff8d50c85acb55083c>:0
[mvx] at MvvmCross.Droid.Support.V7.AppCompat.MvxSplashScreenAppCompatActivity.InitializationComplete () [0x00009] in <74631770bbbe4bff8d50c85acb55083c>:0
[mvx] at MvvmCross.Droid.Platform.MvxAndroidSetupSingleton.<InitializeFromSplashScreen>b__7_1 () [0x0000a] in <099dd6f64bd74189922e6888bc76e146>:0
[mvx] at MvvmCross.Platform.Core.MvxMainThreadDispatcher.ExceptionMaskedAction (System.Action action) [0x00000] in <0da3cbd163cf47a29ec04fff5bb9eecd>:0
I'm using the MVVMCross IOC container and I'm registering de dependencies as follows:
public override void Initialize()
{
base.Initialize();
CreatableTypes()
.EndingWith("Repository")
.AsInterfaces()
.RegisterAsLazySingleton();
CreatableTypes()
.EndingWith("Service")
.AsInterfaces()
.RegisterAsLazySingleton();
Mvx.RegisterSingleton<IUserRestAPI>(new UserRestAPI());
RegisterAppStart(new AppStart());
}
The User service class:
public class UserService : IUserService
{
private readonly IUserRepository _userRepository;
private readonly IDocumentTypesRepository _documentTypesRepository;
private readonly IUserRestAPI _userRestAPI;
public UserService(IUserRepository userRepository, IDocumentTypesRepository documentTypesRepository, IUserRestAPI userRestAPI)
{
_userRepository = userRepository;
_documentTypesRepository = documentTypesRepository;
_userRestAPI = userRestAPI;
}
.
.
.
}
What may be happening?
You can create a PreserveAttribute in your PCL and add it to the classes that the linker is stripping out. Xamarin docs describe the use as
If you do not want to take a dependency on the Xamarin libraries – for
example, you are building a cross platform portable class library
(PCL) – you can still use the Android.Runtime.Preserve attribute. To
do this, declare a PreserveAttribute class within the Android.Runtime
namespace like this:
namespace Android.Runtime
{
public sealed class PreserveAttribute : System.Attribute
{
public bool AllMembers;
public bool Conditional;
}
}
If you want to prevent linking of your shared PCL you can use link skip to prevent the linker from stripping away code from you PCL.
In your android cs proj just add <AndroidLinkSkip>YourPCLAssemblyNameHerer</AndroidLinkSkip> or via the properties UI. Android Options -> Linker -> Skip linking assemblies, enter your PCL assembly name in the input.
I am using EMDK for xamarin in an Xamarain.Android app. I am getting this error:
Unable to activate instance of type Symbol.XamarinEMDK.Barcode.Scanner+IStatusListenerImplementor from native handle 0x1d200001 (key_handle 0x426eae90).
This error occurs randomly.
Find below the detailed logs. Please help in resolving this issue
System.NotSupportedException: Unable to activate instance of type Symbol.XamarinEMDK.Barcode.Scanner+IStatusListenerImplementor from native handle 0x1d200001 (key_handle 0x41b8ad20). ---> System.MissingMethodException: No constructor found for Symbol.XamarinEMDK.Barcode.Scanner+IStatusListenerImplementor::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
at Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
at --- End of managed Java.Lang.Error stack trace ---
at java.lang.Error: Java callstack:
at at mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor.n_onStatus(Native Method)
at at mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor.onStatus(Scanner_StatusListenerImplementor.java:30)
at at com.symbol.emdk.barcode.StatusCallbackInternal$StatusCallbackThread.run(StatusCallbackInternal.java:73)
at --- End of managed Java.Lang.Error stack trace ---
at java.lang.Error: Java callstack:
at at mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor.n_onStatus(Native Method)
at at mono.com.symbol.emdk.barcode.Scanner_StatusListenerImplementor.onStatus(Scanner_StatusListenerImplementor.java:30)
at at com.symbol.emdk.barcode.StatusCallbackInternal$StatusCallbackThread.run(StatusCallbackInternal.java:73)
--- End of inner exception stack trace ---
at Java.Interop.TypeManager.CreateProxy (System.Type type, IntPtr handle, JniHandleOwnership transfer) [0x00058] in <filename unknown>:0
at Java.Interop.TypeManager.CreateInstance (IntPtr handle, JniHandleOwnership transfer, System.Type targetType) [0x00138] in <filename unknown>:0
--- End of inner exception stack trace ---
at Java.Interop.TypeManager.CreateInstance (IntPtr handle, JniHandleOwnership transfer, System.Type targetType) [0x001b0] in <filename unknown>:0
at Java.Lang.Object.GetObject (IntPtr handle, JniHandleOwnership transfer, System.Type type) [0x000e5] in <filename unknown>:0
at Java.Lang.Object._GetObject[T] (IntPtr handle, JniHandleOwnership transfer) [0x0001a] in <filename unknown>:0
at Java.Lang.Object.GetObject[T] (IntPtr handle, JniHandleOwnership transfer) [0x00000] in <filename unknown>:0
at Java.Lang.Object.GetObject[T] (IntPtr jnienv, IntPtr handle, JniHandleOwnership transfer) [0x00006] in <filename unknown>:0
at Symbol.XamarinEMDK.Barcode.Scanner+IStatusListenerInvoker.n_OnStatus_Lcom_symbol_emdk_barcode_StatusData_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0) [0x00000] in <filename unknown>:0
at at (wrapper dynamic-method) System.Object:043283ed-110f-43b7-811b-51b1dfa39e65 (intptr,intptr,intptr)
Just adding this in case someone may stumble onto it in the future
Not sure why are you getting that error, but here's a code sample that works without having to add an implementation of the IStatusListenerImplementor interface.
private void SetupEmdkBarcodeScanner
{
var emdkBarcodeManager = (Symbol.XamarinEMDK.Barcode.BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
var emdkBarcodeScanner = emdkBarcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.Default);
if(emdkBarcodeScanner.IsReadPending)
{
emdkBarcodeScanner.CancelRead();
}
emdkBarcodeScanner.Data += HandleReadEvent;
emdkBarcodeScanner.Status += HandleStatusEvent;
}
private void HandleStatusEvent(object sender, Scanner.StatusEventArgs e)
{
if (e.P0.State != StatusData.ScannerStates.Idle)
{
return;
}
lock (concurrentReadsLock)
{
Thread.Sleep(100);
if (scanner.IsReadPending)
{
return;
}
emdkBarcodeScanner.Read();
}
}
private void HandleReadEvent(object sender, Scanner.DataEventArgs e)
{
if (e.P0.Result != ScannerResults.Success)
{
return
}
foreach (ScanDataCollection.ScanData data in e.P0.GetScanData())
{
string aimBarcodeData = data.Data; //here is your scanned barcode (e.g.: "]E00123456789123"
//... your barcode processing code goes here //
}
}
Also, don't forget to dispose at the end:
emdkBarcodeScanner.CancelRead();
emdkBarcodeScanner.Disable();
//.. unsubscribe the event handlers
emdkBarcodeScanner.Dispose();
//...and finally release the EMDK to remove your application's exclusive access.
emdkBarcodeManager.Release(EMDKManager.FEATURE_TYPE.Barcode);
Getting an exception when selecting a Release Template and choosing "New Release" on "Configure Apps" tab of RM for Visual Studio 2013 Client.
After clicking "New Release" a pop-up appears in the lower right corner of the screen with "Unhandled Exception" and red stop sign. Looking through Event Viewer, below is the stack trace.
Anyone else encountering the same error?
The only step in the Release Template is to copy files to a DEV server on the same subnet.
Message: The remote server returned an error: (500) Internal Server Error.: \r\n\r\n at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Microsoft.TeamFoundation.Release.Data.WebRequest.PlatformHttpClient.EndGetResponse(IAsyncResult asyncResult)
at Microsoft.TeamFoundation.Release.Data.WebRequest.RestClientResponseRetriever.EndGetAsyncMemoryStreamFromResponse(IAsyncResult asyncResult, IPlatformHttpClient platformHttpClient)
at Microsoft.TeamFoundation.Release.Data.WebRequest.RestClientResponseRetriever.EndDownloadString(IAsyncResult asyncResult, IPlatformHttpClient platformHttpClient)
at Microsoft.TeamFoundation.Release.Data.WebRequest.RestClient.EndPost(IAsyncResult asyncResult)
at Microsoft.TeamFoundation.Release.Data.Proxy.RestProxy.HttpRequestor.<>c__DisplayClass1.<GetPostCaller>b__0(String url, String body)
at Microsoft.TeamFoundation.Release.Data.Proxy.RestProxy.BaseDeploymentControllerServiceProxy.PopulateTaggedActivities(String workflowXml, Int32 environmentId)
at Microsoft.TeamFoundation.Release.Data.Model.Release.BuildReleaseStages(ReleasePath selectedReleasePath, XElement applicationVersion)
at Microsoft.TeamFoundation.Release.Data.Model.Release.BringDataFromApplicationVersion()
at Microsoft.TeamFoundation.Release.Data.Model.Release.OnPropertyChanged(String propertyName, Boolean setDirty)
at Microsoft.TeamFoundation.Release.Data.Model.PropertyChangedBase.OnPropertyChanged(String propertyName)
at Microsoft.TeamFoundation.Release.Data.Model.Release.set_ApplicationVersionId(Int32 value)
at Microsoft.VisualStudio.Release.ViewModel.ViewModels.ReleaseViewModel.Initialize(Int32 modelId)
at Microsoft.VisualStudio.Release.ViewModel.ViewModels.ReleaseViewModel..ctor(String viewMode, Dictionary`2 popupParameters)
at Microsoft.VisualStudio.Release.ViewModel.ViewModels.ApplicationVersionsViewModel.CreateNewRelease(Int32 releaseTemplateId)
at Microsoft.VisualStudio.Release.ViewModel.ViewModels.ApplicationVersionsViewModel.CreateRelease(XElement selectedItem)
at Microsoft.VisualStudio.Release.ViewModel.ViewModels.ApplicationVersionsViewModel.CreateNewRelease(Object selectedItems)
at Microsoft.VisualStudio.Release.ViewModel.Helpers.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
Category: General
Priority: -1
EventId: 0
Severity: Error
Issue was permissions related. Fixed by adding AD computer name in Release Management server users.
I'm hosting a Web API in IIS (7.5) as an Application under "Default Web Site", and am using several of the Enrichers from Serilog.Extras.Web (I'll be upgrading soon to the SerilogWeb.Classic package). I noticed in my logs that ApplicationLifecycleModule.LogRequest() was being called twice for each request, and I'm trying to understand why.
What I noticed is that ApplicationLifecycleModule.Init() is being called twice, thus registering two event handlers.
The first callstack:
Serilog.Extras.Web.dll!Serilog.Extras.Web.ApplicationLifecycleModule.Init(System.Web.HttpApplication context)
System.Web.dll!System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(System.IntPtr appContext, System.Web.HttpContext context, System.Reflection.MethodInfo[] handlers)
System.Web.dll!System.Web.HttpApplication.InitSpecial(System.Web.HttpApplicationState state, System.Reflection.MethodInfo[] handlers, System.IntPtr appContext, System.Web.HttpContext context)
System.Web.dll!System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(System.IntPtr appContext, System.Web.HttpContext context)
System.Web.dll!System.Web.Hosting.PipelineRuntime.InitializeApplication(System.IntPtr appContext)
[AppDomain Transition]
And the second:
Serilog.Extras.Web.dll!Serilog.Extras.Web.ApplicationLifecycleModule.Init(System.Web.HttpApplication context)
System.Web.dll!System.Web.HttpApplication.InitModulesCommon()
System.Web.dll!System.Web.HttpApplication.InitInternal(System.Web.HttpContext context, System.Web.HttpApplicationState state, System.Reflection.MethodInfo[] handlers)
System.Web.dll!System.Web.HttpApplicationFactory.GetNormalApplicationInstance(System.Web.HttpContext context)
System.Web.dll!System.Web.HttpApplicationFactory.GetApplicationInstance(System.Web.HttpContext context)
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
Am I doing something wrong? Or is this a bug in the ApplicationLifecycleModule?