Xamarin - Designer does not load - c#

I am trying to create a new Xamarin (blank app) project, and when I am opening the file "Main.axml" I get this error:
The error-text inside this "messagebox" is this:
System.ArgumentNullException: Value cannot be null. Parameter name: o
at
System.Runtime.InteropServices.Marshal.GetIUnknownForObjectNative(Object
o, Boolean onlyInContext) at
Xamarin.AndroidDesigner.Windows.WindowsAndroidSurfaceRenderer.UpdateD3DImageFromSharedSurface()
in
E:\A_work\102\s\Xamarin.Designer.Android\Xamarin.AndroidDesigner.Windows\WindowsAndroidSurfaceRenderer.cs:line
140 at
Xamarin.AndroidDesigner.Windows.WindowsAndroidSurfaceRenderer.RenderDesignerItemVisual(DesignerItem
item) in
E:\A_work\102\s\Xamarin.Designer.Android\Xamarin.AndroidDesigner.Windows\WindowsAndroidSurfaceRenderer.cs:line
131 at
Xamarin.Designer.Windows.WpfSurfaceRenderer.QueueRender(DesignerItem
item) in
E:\A_work\102\s\Xamarin.Designer\Xamarin.Designer.Windows\WpfSurfaceRenderer.cs:line
361 at
Xamarin.AndroidDesigner.AndroidDesignerSurface.HandleSessionImageChanged(Object
sender, EventArgs e) in
E:\A_work\102\s\Xamarin.Designer.Android\Xamarin.AndroidDesigner\Xamarin.AndroidDesigner\AndroidDesignerSurface.cs:line
229 at
Xamarin.AndroidDesigner.AndroidDesignerSession.OnImageChanged() in
E:\A_work\102\s\Xamarin.Designer.Android\Xamarin.AndroidDesigner\Xamarin.AndroidDesigner\AndroidDesignerSession.cs:line
2037 at
Xamarin.AndroidDesigner.AndroidDesignerSession.HandleRendered(Object
sender, EventArgs e) in
E:\A_work\102\s\Xamarin.Designer.Android\Xamarin.AndroidDesigner\Xamarin.AndroidDesigner\AndroidDesignerSession.cs:line
1284
--- End of stack trace from previous location where exception was thrown --- at
Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception
exceptionObject)
I found several topics through google that talk about the same issue, but either none of them explain if and how they solve the issue, or he solution was not working. If someone has encounter this error, it would be great to give me the solution for it.
EDIT: I use:
1) Visual Studio Community 2017 - Version 15.6.6 2) JDK Version: 1.8.0_171 3) Xamarin Version: 4.9.0.753 4) Xamarin Designer Version: 4.10.96

Related

Line numbers in stack traces for UWP apps

I created a blank Universal Windows App project in Visual Studio 2015.
I add something like:
try {
string foo = null;
int len = foo.Length;
} catch (Exception ex) {
System.Diagnostics.Debug.WriteLine(ex);
}
I get a stack trace like:
Exception thrown: 'System.NullReferenceException' in TestStackTraces.exe
System.NullReferenceException: Object reference not set to an instance of an object.
at TestStackTraces.App.OnLaunched(LaunchActivatedEventArgs e)
i.e., No line numbers.
How do I get line numbers to show up?
This appears to be no longer supported. I am re-posting my answer here, because when I did a search for my answer on another question, it was very difficult to find it in the search results. Hopefully this question will help people find this info easier.
Reference: windows 10 exceptions not including line numbers
Other info:
See corefx #1420 and related corefx #1797.
Also, there is this reference on SO: How to get StackTrace without Exception in Windows Universal 10 App

Assuredly simple C# file saving issue

We have a custom built web application built on ASP (2.0 it looks like) using C#. We recently moved it from an IIS6 environment to an IIS7. We have run into an issue where a page set up to view images that had been retrieved via a search is throwing an error. The code takes a copy of the image file and puts it into a work directory renaming the copy to the user's name.
bmpList[0].Save("c:\\inetpub\\wwwroot\\SiteName\\Work\\" + ((ImageUser)Session["ImageUser"]).Username + ".TIF", info, encParams);
I know that the wwwroot is no longer a valid directory in the path so I changed it to...
bmpList[0].Save("c:\\inetpub\\SiteName\\Work\\" + ((ImageUser)Session["ImageUser"]).Username + ".TIF", info, encParams);
Saved the file, did and IIS restart and cleared my browser cache and still receive an error...
A generic error occurred in GDI+.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
Source Error:
Line 180:
Line 181: //bmpList[0].Save("c:\\pi\\" + ((ImageUser)Session["ImageUser"]).Username + ".TIF", info, encParams);
Line 182: bmpList[0].Save("c:\\inetpub\\wwwroot\\SiteName\\Work\\" + ((ImageUser)Session["ImageUser"]).Username + ".TIF", info, encParams);
Line 183:
Line 184: for (int a = 1; a < numFiles; a++)
Source File: c:\inetpub\Sitename\SiteApp\View.aspx.cs Line: 182
Stack Trace:
[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +615209
View.Page_PreRender(Object sender, EventArgs e) in c:\inetpub\SiteName\SiteApp\View.aspx.cs:182
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnPreRender(EventArgs e) +11056766
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
It seems like a fairly straightforward thing but for some reason it is not updating (the path in the error remains exactly the same). What am I missing?
Almost all the time (i.e 99.9999% of the times), when using GDI, 'a generic error occured' means that the directory you are trying to save to doesn't have the proper permissions. Typically, you need to make sure that directory is allowing asp.net to modify files. Did you check the permission on the directory you are trying to save the files to?
So oddly enough the answer is actually as simple as it looks... almost.
Changing...
c:\inetpub\wwwroot\SiteName\Work\
to...
c:\inetpub\SiteName\Work\
worked. Why it was continuing to give me the same error from the browser after I changed the code on the .cs file was that the IP that they had bound to the site still belonged to a previous version of the machine so DNS was routing me over to that box instead. All said it ended up I was on the wrong OSI model layer. I only discovered it when I went to build a test version on the same box and went to unbind the IP from the broken site and bind it to my second test site and I found that the IP I wanted wasn't an option (so it must have been manually entered). Live and learn. Thanks for the input and advise.

1 Error "ResolveManifestFiles" System.ArgumentException: Value does not fall within the expected range. WPF C# Desktop app

Im tray to compile a Visual Studio Solution and get this error.
Error 1 Error inesperado en la tarea "ResolveManifestFiles".
System.ArgumentException: Value does not fall within the expected range.
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.NativeMethods.GetAssemblyIdentityFromFile(String filePath, Guid& riid)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.MetadataReader.ImportAttributes()
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.MetadataReader.get_Attributes()
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.MetadataReader.get_Name()
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.AssemblyIdentity.FromManagedAssembly(String path)
at Microsoft.Build.Tasks.ResolveManifestFiles.IsFiltered(ITaskItem item)
at Microsoft.Build.Tasks.ResolveManifestFiles.GetOutputAssemblies(PublishInfo[] publishInfos, List`1& assemblyList)
at Microsoft.Build.Tasks.ResolveManifestFiles.GetOutputAssembliesAndSatellites(PublishInfo[] assemblyPublishInfos, PublishInfo[] satellitePublishInfos)
at Microsoft.Build.Tasks.ResolveManifestFiles.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() Ziruma
Im not sure what is the problem. Project compiling until i try to generate the final instalation package. Please, help me.

Cannot navigate between pages anymore

I have a new app and I am trying to navigate to another page:
private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
this.Frame.Navigate(typeof(MultiView));
}
This same code works in previous apps I've made. I don't understand why it's not working anymore.
The exception thrown is:
System.ArgumentNullException was unhandled by user code HResult=-2147467261 Message=Value cannot be null. Parameter name: key Source=mscorlib ParamName=key StackTrace:
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at MyAppName.Common.LayoutAwarePage.OnNavigatedFrom(NavigationEventArgs e) in c:\Users\UserName\Documents\Visual Studio 2013\Projects\MyAppName\MyAppName\Common\LayoutAwarePage.cs:line 373
at MyAppName.MainPage.OnNavigatedFrom(NavigationEventArgs e) in c:\Users\UserName\Documents\Visual Studio 2013\Projects\MyAppName\MyAppName\MainPage.xaml.cs:line 804 InnerException:
How can I navigate to another page? (I am using the same code as described in MSDN documentation. And I've been over it many times. This has never been a problem until now.

Exception error message with incorrect line number

When an exception is thrown in an Asp.Net web page, an error message is displayed with the complete stack trace.
Example below:
Stack Trace:
IndexOutOfRangeException: Index was outside the bounds of the array.
MyNameSpace.SPAPP.ViewDetailsCodeBehind.LoadView() +5112
MyNameSpace.SPAPP.ViewDetailsCodeBehind.Page_Load(Object sender, EventArgs e) +67
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +43
System.Web.UI.Control.OnLoad(EventArgs e) +98
... ...
The problem is that the Line number displayed does not correspond to the line in my code that originated the exception.
In the example above, the stack shows line number 5111, yet my code behind .cs file only has 250 lines!
The aspx page is stored in a SharePoint site and the Assembly with the code behind has been deployed to GAC. Also, I've compiled in Debug mode.
Given the settings above, how can I find out what line in my code caused the Exception?
Clarification as pointed out by strelokstrelok:
In Release mode the number in front of the exception is NOT the line of code. Instead it's an offset to the native compiled code, which doesn't have any meaning to humans. More about this here: http://odetocode.com/Blogs/scott/archive/2005/01/24/963.aspx
In debug mode the PDB file will automatically map the native code offset to your .cs line in code and the number displayed WILL be the corresponding line in code.
Those numbers are NOT line numbers. In Release mode the stack trace contains the offsets into the native compiled code instead of line numbers. You can read some more about it here:
http://odetocode.com/Blogs/scott/archive/2005/01/24/963.aspx
The only way to get line numbers in a stack trace is if you built you code in debug mode with the PDB files available.
Your code behind file is not the complete class, it's only a portion that is used when the class as a whole is compiled by ASP.NET. To find what is truly on that line, take a look at the compiled class / assembly using a tool like Reflector.
Maybe the running code is not what you see on your screen. Some mate might have refactored it for you. :)

Categories

Resources