androidx.camera.view.PreviewView Causes java.lang.NullPointerException in Xamarin.Android Designer - xamarin.android

I am working on adding an androidx.camera.view.PreviewView to my Xamarin.Android app, but it displays a java.lang.NullPointerException in the Xamarin.Android Designer in Visual Studio 2022. The Details: displayed in the Designer are as follows:
android.hardware.display.DisplayManager.registerDisplayListener(DisplayManager.java:414)
androidx.camera.view.PreviewView.startListeningToDisplayChange(PreviewView.java:970)
androidx.camera.view.PreviewView.onAttachedToWindow(PreviewView.java:299)
android.view.View.dispatchAttachedToWindow(View.java:18347)
android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3397)
android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3404)
android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3404)
android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3404)
android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42)
com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:330)
com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:394)
com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:271)
mono.android.DesignerSession.loadInternal(DesignerSession.java:273)
mono.android.DesignerSession.lambda$load$0(DesignerSession.java:223)
mono.android.MonoDroidBroker.executeInMonoDroidContext(MonoDroidBroker.java:76)
mono.android.DesignerSession.load(DesignerSession.java:223)
mono.android.DesignerSession.processMessage(DesignerSession.java:676)
mono.android.MessageListener.executeMessage(MessageListener.java:88)
mono.android.MessageListener$Runner.run(MessageListener.java:44)
java.lang.Thread.run(Thread.java:748)
The exact xml of the PreviewView is as follows:
<androidx.camera.view.PreviewView android:id="#+id/pvCurrent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="0" android:layout_row="0" tools:layout_width="match_parent" tools:layout_height="150dp" tools:background="#color/Three"/>
I am not sure what to do, since this is my first time with PreviewView & it is a design time exception. What is the problem?

Probably just a limitation of the Android Designer in Visual Studio. Just like it can't handle a navigationgraph.xml without raising an exception. The android designer hasn't had any work done on it since about 2019 and totally sucks.
Use Android Studio's designer and when you get your design right, copy/paste the XML into an empty file you create with VS's android designer.
If that doesn't work then you have some other problem.

Related

Change syntax highlight for Javascript in visual studio 2019

Can you customise colors of javascript editor in visual studio 2019 to have the same has in vscode, I already look into the police and fonts editor of vs2019 + extensions for more User Tags but none of them change the colors settings.
What I want
What I have
I having same problem, Javascript sytnax color in Visual Studio 2019 seems broken for now:
https://developercommunity.visualstudio.com/content/problem/1127320/lost-typescript-intellisense-and-sytnax-coloring-i.html
The only solution for me is using VSCode..
VS ReShaper extension supports VSCode-like syntax highlighting:
https://www.jetbrains.com/help/resharper/Coding_Assistance__Syntax_Highlighting.html
Example: https://i.imgur.com/Atw4yBP.png
The only caveat being ReShaper is not free and causes lag. However, there are many extensions claiming to replace (parts of) ReShaper and chances are one of these also enables similar syntax highlighting.

How do I make the Visual Studio 2019 Output window "visible by default" on start again?

Some time ago, Visual Studio 2019 told me that the "Output" window caused a Visual Studio start-up delay of X seconds and offered me to hide the window on start.
I accepted that offer, and now, after some time, I discovered that having to re-pin the Output window once per Visual Studio session is super-annoying, and that I would like things back the way they were before.
I browsed through the Visual Studio options (specifically Environment/Startup and Environment/"Tabs and Windows"), but I did not find an option to undo that change. What did I miss?
I know that I could reset Visual Studio to default settings, but I want to avoid that, because then I'd lose all my custom settings. (No bounty will be awarded for suggesting this, unless the answer also proves that there is no other option.)
I also know that I could pin the output window and then "save" the layout as a custom layout. I don't want that, I want to modify the "default" layout loaded on start.
(Rubber-duck debugging at its best: 5 minutes after starting a bounty I find the solution myself. Go figure!)
In the Visual Studio menu, go to Help/Visual Studio Performance Manager, which brings up this helpful dialog:
Setting this option back to "Use default behavior" fixes the issue.

Hide suggested text when typing in Visual Studio 2019

Does anyone know how to turn off this annoying popup in Visual Studio Community 2019?
All the answers I see for it are for Visual Studio Code when I google it, which says to change it under the "File" > "Preferences" menu. Visual Studio 2019 doesn't have that menu. I just want to code without visual obstructions from my editor. Driving me nuts. Thank you!
The language is VB in ASP Classic environment.
I have turned off everything I could find that seems like it could be related to a popup under the "Options" menu, but many of the descriptions there are obscure. You could seriously make a full time job out of learning what all this stuff means.
I found an answer, however odd it may be. With #JackArbiter's help in narrowing down the possibilities, it turned out to be the file type within the environment that was the issue. I didn't realize at first that it was only a certain file extension that was creating the issue. The *.asp files behaved appropriately, but the *.inc files were the problem.
I went to "Options" > "Text Editor" > "File Extension" and added the "inc" file extension there with the editor set to Visual Basic. These files now behave the same as the asp files.
Go to Tools>Options>Text Editor>[Your markup or language] and you can adjust the intellisense settings. In your case there will be no intellisense settings listed (general HTML is what I assume to be the issue here, though you'll have to do this again probably for the language of the IF/Else code blocks) so go to HTML>General and uncheck "Auto list members" at the top.

How to Reset Window Layout in Visual Studio for Mac

Is it possible to reset window layout in Visual Studio for Mac? I am able to do this for Visual Studios on Windows, but not on Mac version.
After piecing together various posts I found only a non-UI way to reset the layout. Starting with this doc: http://www.monodevelop.com/developers/articles/user-profiles/ but instead of using the path "MonoDevelop" use "VisualStudio". So in the case of a Mac the folder to visit is at "~/Library/Preferences/VisualStudio".
Once there I found the "7.0" subfolder had a file named "EditingLayout.xml"... With VS for Mac not running, I deleted that file and started it again. This restored all pads to their default state from what I can tell. In my case the "Application Output" window was still not available as a Pad until I actually did a Debug on a project, and then it was visible again in the View | Pads list (and no longer lost in the UI somewhere).
You can press the view tab to change the different layouts or create one of your own.
Additional informations can be found here:
https://learn.microsoft.com/en-us/visualstudio/mac/customizing-the-ide?view=vsmac-2019
I met this problem also, Visual Studio for Mac can't reset Window Layout in UI. But you can easily customize the Window Layout. Just select "View->Pads/Debug Pads" to decide what window you want to show on the dashboard.
enter image description here
Just to have a more up-to-date answer: when you quit Visual Studio Mac 2019, any changes made to the active layout will be reset to how the layout was saved.
From the Visual Studio Website:"There is always one active layout and any change you make in a layout, such as adding or repositioning a pad, will only change the active layout. Once you close Visual Studio for Mac, the changes you have made will not be saved." Visual Studio Website - Customising The IDE
I've tested it out for Visual Studio Community 2019 for Mac Version 8.7.8 (build 4), and now it really does just reset when you quit the app, unless you have specifically saved any changes as a new layout.

Visual Studio 2013 Document Outline tool always empty

I'm currently editing a large CSS-file in the Visual Studio 2013 editor, and would hugely benefit from a tool that hierarchically listed the content of the files I'm editing. From what I understand, the Document Outline (DO) tool in VS is supposed to achieve this, however, it never actually displays anything; regardless of the document I am editing while the DO panel is visible (CSS, C#, JS, XML etc..), it just tells that:
There are no items to show for the selected document.
First of all, is the DO the right tool for the job, and if yes, how do I get it to display my pages' content? Am I perhaps missing some dll-files?
For the reference, I am developing an asp.net-MVC application.
You may want to install the Mexedge Stylesheet Extension that displays CSS structure in Solution Explorer.

Resources