KeyNotFoundException when trying to dervive from theme Theme.AppCompat.DayNight.NoActionBar - xamarin.forms

I'm trying to write an app using Xamarin.Forms in Visual Studio 2022 for target Android 12. I can compile and debug the app without any problems, but when I'm trying to archive it, I get a KeyNotFoundException without any other information.
I found out, that my theme is responsible for this error:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
</style>
</resources>`
When I use Theme.AppCompat.DayNight.NoActionBar here, I get the error when trying to archive. The error doesn't occur with the default parent (MainTheme.Base).
When debugging the app, the theme seems to work and the error only occurs when trying to archive the final app. Does anybody know what I'm doing wrong?

After retrying with an empty project and not being able to reproduce it, I stumbled over some obsolete references to System.ComponentModel.Annotations and Newtonsoft.Json.
After removing them, I can now archive the app.
No idea why the problem only occured with these references AND Theme.AppCompat.DayNight.NoActionBar set as parent theme, but I'm glad it works now.
Edit: After being able to archive many times now, the error suddenly occured again, but this time could be resolved by restarting VS.
Seems like the error is just some kind of hickup.

Related

VS 2022: Breakpoint will not currently be hit. No symbols have been loaded for this document

I have a VS 2022 solution with a WPF client and ASP.NET backend and when I put breakpoints in the backend web services they have the yellow tag with a message:
Breakpoint will not currently be hit. No symbols have been loaded for
this document.
I run the solution with the WPF project set as the start project, but, if I test this by setting the web project as the start project - the symbols will load, but of-course this is useless as the wpf app is not running.
A little history: This solution was running on my old dev PC (same version of everything) and all worked as expected, but when loading all solutions onto my new PC, this problem started up. I have googled this and found a ton of posts about it and have tried everything, but nothing has worked yet.
I can run the solution and attach to the process and then debug, but since I will be debugging 100s and 100s of times, those extra steps are a real pain and I have been able to debug asp.net projects from wpf for many years up to now.
Can someone please recommend some additional steps I can take to solve this problem?
FYI, I Have been through everything from this link:
How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?
Thanks.
Common method:
In VS, go to Tools --> Options --> Debugging --> General, and then cancel the checks in front of [Enable "Only My Code"] and [Require source files to exactly match the original version].
But this method you may have tried.
Ultimate method:
When the breakpoints clicked by the mouse are invalid, you can perform the following operations in vs:
Debug --> delete all breakpoints
Debug --> New Breakpoint --> Function Breakpoint, and then enter the name of the function to add a breakpoint

What is causing intermittent "Object reference not set to an instance of an object" at compile time in VS 2010?

I am sorry if this is not really a coding question (it depends on if its my code causing the problem I suppose).
I have seen this question: Tracking down intermittent 'Object reference not set to an instance of an object.' error on build
However, it has not been of much help (although if you read the comments, you will see that I thought it did help for a while there).
When I try publish my website, occasionally, I will get an error with no file or line reference:
Pre-compiling Web Site
Building directory '/App_Code/'.
Building directory '/'.: Publication (web): Object reference not set to an instance of an object.
Pre-compilation Complete
------ Skipped Publish: Project X:\, Configuration: Debug Any CPU ------
I know the usual causes of "Object reference not set to an instance of an object" but this seems a bit different, isn't it supposed to be a runtime error? Not a build error?
What is weird is that it happens, seemingly at random (about 25%-33% of the time). I can try to publish it and have it fail. Then try again straight after, without changing anything and it works fine.
I started getting this error after moving some of my functions (VB.net btw) to a new file in the App_Code folder so they can be accessed by all pages of the site.
If you need any more info, please let me know.
Thanks,
EDIT: After further investigation, it seems to only happen if I try to publish the website within a few seconds of saving changes to any file within it. What could cause this?
The same error occurred for me to, I deleted the dlls of the custom controls in the web site that are already in the bin, then i published the web site, and succeeded
IF you have any custom/usercontrols in your project, they are actually running at design time and can give object ref errors. This can occur during builds too. In that case, a property is being referenced that is NOTHING and throws the error.
I had a similar problem with a Windows Form project.
Wherever I try to move a custom control on the windows form, and then try to save the form, VS2010 comes back with "Object not set to an instance of an object".
I suspected the error was deep down in the layers of abstraction in my inherited code, but couldn't work out how deep to go, without reviewing every line of code.
My solution to this problem is this.
Open up another instance of Visual Studio 2010
Menu: Debug | Attach to Process..
Search for "devenv.exe xxx YourApplicationName..." and select it
Click "Attach"
Menu: Debug | Exceptions..
Tick all the boxes in the thrown column, then "OK"
Your second instance of VS2010 is not debugging your first instance, including all the custom controls.
Return to the first instance of VS2010, and repeat the actions that caused the error in the first place, the second instance of VS2010 will break at the line of code that has the error.
You may want to look at this link there is a bug in vs2012
https://connect.microsoft.com/VisualStudio/feedback/details/749901/error-when-i-click-publish-object-reference-not-set-to-an-instance-of-an-object

getting error "The server block is not well formed" in netframework.aspx

I opened up a large asp.net project in Visual Studio 2010; the project hadn't been touched for a couple of months, and the last time I had it opened, it built fine. But today it's getting errors during the build -- EDIT -- actually, Build and Rebuild both work; it's not until I try to Start Debugging that the errors occur.
DESCRIPTION.............................FILE...............LINE
"The server block is not well formed" netframework.aspx 275150
and the following unreadable garbage:
Literal expressions like '<%$ AëÜË ¾ø2µ¬GP‰¦M†M²·tÕEôâ3)ú覢Š7*ÃGzü‰v;§h¿ñÒÿÕùhXY&˜ŠÐ÷Îç&þÊoaãÙ,–ûm…iû^|J[jÜϱ­R[˜ó-ü×?¦S8I FÙœh¶©)CO-qz†ô—„„mó+‚ìW¼„ý–åC6Emo«„>v¥>¨C,íc«2•dŸwì9+®Vù#üãwš^(œè ξñF4×ME½Ú"ÝÚd$eO›N ‹˜Î8±°K×E<·NØKäµ)›‚Ù¥¬ ý—Ÿ##”e¸fšæPÐ{³ãQèëZ/G½Ci„å…€bØǽá_$ÄøÛ±ÝÆÅÇÀáèÅš¼”kôX¨ÇHŽEŸñΘLJÑ”NÀ$_ü€ô>$Y,I ¥u»dFÒ~WH*”D:ì1<:ꪩ[k¥õ²éÍ"ìâ®hàŽ)Ûp7”d—rTÚÇICýp†5Å«¡#ØJª‡è›Þ"RËŠÚ‰Åi‰ï/ªîë 7±¶cYJ¯¬—àÖ’öGUéÒ ;î’mõnÛ¿Xè‹Oñ&BɸÄ}ŽåíXÑ­¬¯ë3Ê*’;ëÔÙÆv½‡ sk)¾ÀÈBk±mvõò3c]¾UsLq/¶Ùî~')ÛraÀÖ,ó››Kì¦é…¾QtÃ$šÁl¸"èG樘´aÔ}qÛžòn!=ÎéCáê©H¢J7C5ˆQ»™bXO“ø³ê¶®^'d0ï0”ÃæBD›“©/©;“îqe_Åk/k“‚ ε­hnŸëœÍ<07Ó#ñ""'ÐÒ—g UQ5ósžýªí”vÓZ"\yzÈ„+ø_V»;wlmùÎ ñI+謓ª‚­ ãpñ+ÜŸt”z­SŠÈPíÒÑðw9#DUpÞJ«vú C:\inetpub\wwwroot\MYAPP\netframework.aspx 177272
How do I begin to troubleshoot these errors in a large project? As I said, last time it was opened it built fine--- EDIT: and ran fine.
For what it matters now, for this problem on my machine, I found I was #Import(ing) a namespace in the partial view that was being called but the reference was not being used. I removed the namespace #Import and the error went away.

Flex SDK missing fundamental things

alt text http://img710.imageshack.us/img710/4107/flashbuildershite.jpg
All of a sudden Flash Builder 4 is missing all kinds of fundamental things and is generating incorrect errors. I've had the same issue yesterday, where I fixed it by downloading a new Flex SDK and importing that into FB. I did this again, but this time it fixed nothing.
I don't think it's something I did, like removing critical references from the build path. The errors also appeared on projects I was not working on at the time. It occurs for ActionScript, Flex and Flex Library projects alike.
Update 3: Well, i've singled the problem down to a single piece of code, though a very simple one. I can make a new workspace in FB and things work ok, then screw the workspace up forever by adding this code to a project. All projects will have errors and closing or even removing the faulty project does not change this. Making another new workspace (without the faulty code) makes my projects compile again.
Link: http://www.the3rdage.net/files/2745/Main.as
(i've uploaded the file in case an odd character or encoding error causes the error)
Update 2: I've tried manual compiling with mxmlc, the same errors occur. It appears to be an SDK problem, not Flash Builder.
Update: I find this stack trace in the Flash Builder error log:
!ENTRY com.adobe.flexbuilder.project 4 43 2010-05-11 11:55:47.495
!MESSAGE Uncaught exception in compiler
!STACK 0
java.lang.NullPointerException
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2592)
at macromedia.asc.parser.VariableBindingNode.evaluate(VariableBindingNode.java:64)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2233)
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:44)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2578)
at macromedia.asc.parser.VariableDefinitionNode.evaluate(VariableDefinitionNode.java:48)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2310)
at macromedia.asc.parser.StatementListNode.evaluate(StatementListNode.java:60)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2503)
at macromedia.asc.parser.WithStatementNode.evaluate(WithStatementNode.java:44)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2310)
at macromedia.asc.parser.StatementListNode.evaluate(StatementListNode.java:60)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2891)
at macromedia.asc.parser.FunctionCommonNode.evaluate(FunctionCommonNode.java:106)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2905)
at macromedia.asc.parser.FunctionCommonNode.evaluate(FunctionCommonNode.java:106)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:3643)
at macromedia.asc.parser.ClassDefinitionNode.evaluate(ClassDefinitionNode.java:106)
at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:3371)
at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:80)
at flex2.compiler.as3.As3Compiler.analyze4(As3Compiler.java:709)
at flex2.compiler.CompilerAPI.analyze(CompilerAPI.java:3089)
at flex2.compiler.CompilerAPI.analyze(CompilerAPI.java:2977)
at flex2.compiler.CompilerAPI.batch2(CompilerAPI.java:528)
at flex2.compiler.CompilerAPI.batch(CompilerAPI.java:1274)
at flex2.compiler.CompilerAPI.compile(CompilerAPI.java:1496)
at flex2.tools.oem.Application.compile(Application.java:1188)
at flex2.tools.oem.Application.recompile(Application.java:1133)
at flex2.tools.oem.Application.compile(Application.java:819)
at flex2.tools.flexbuilder.BuilderApplication.compile(BuilderApplication.java:344)
at com.adobe.flexbuilder.multisdk.compiler.internal.ASApplicationBuilder$MyBuilder.mybuild(ASApplicationBuilder.java:276)
at com.adobe.flexbuilder.multisdk.compiler.internal.ASApplicationBuilder.build(ASApplicationBuilder.java:127)
at com.adobe.flexbuilder.multisdk.compiler.internal.ASBuilder.build(ASBuilder.java:190)
at com.adobe.flexbuilder.multisdk.compiler.internal.ASItemBuilder.build(ASItemBuilder.java:74)
at com.adobe.flexbuilder.project.compiler.internal.FlexProjectBuilder.buildItem(FlexProjectBuilder.java:480)
at com.adobe.flexbuilder.project.compiler.internal.FlexProjectBuilder.build(FlexProjectBuilder.java:306)
at com.adobe.flexbuilder.project.compiler.internal.FlexIncrementalBuilder.build(FlexIncrementalBuilder.java:157)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Did you get a chance to list this issue in their bugs list. I have not yet tried Flex 4. did you try to refresh your project and re open your flash builder.
Update:
What about a simple project. I think you are trying to load something which its not able to get.
mxmlc - verify-digests
Try this.
Problems I've had that were somewhat similar, once I had FB running under the wrong version of Java. Another time I had done some edits to the flex-config.xml file in order to make it work with a Maven plugin we had written in house. After that we made the plugin look at a copy of the original xml file, so that problem went away.
hth.
Might i recommend HFCD? The HellFire Compile Daemon is an out of process flex compiler that speeds up compile times immensely, and almost more importantly runs in a separate process from FlashBuidler. I have had some absolutely horrendous errors with Flash Builder due to the complexity and size of our project, where HFCD has helped tremendously here.

Tracking down intermittent 'Object reference not set to an instance of an object.' error on build

I could use some help trying to track down an intermittent error that I've been having with our ASP.Net project for quite some time.
Intermittently when building the solution, the build will fail with the error "/: Build (web): Object reference not set to an instance of an object." The error has no associated file, line, column or project information. The weird thing about the error is that it will go away on successive rebuilds and doesn't seem to result in any run-time errors that we've come across once the build is successful. Sometimes the error will pop only once, sometimes 3-4 times, but eventually the build will finish successfully and then seems to build just fine each time after. I haven't been able to nail down a pattern as to why and when the error will happen, and since it always eventually builds it hasn't been a critical problem for us. Just an annoyance. But one that I want gone for obvious reasons.
I guess I should add that this is an application that was originally developed in ASP.net 1.1 and converted to 2.0 and I inherited it somewhere down the line after that, so I don't know when the problem originally surfaced. As far as everyone here is concerned, it's always been there.
Obviously I'm not expecting someone to pick out the cause of my problem as that would require them to look at our entire solution to pick out potential problems. Just hoping someone can give me a couple fresh ideas as to how to go about tracking down the actual source of the error in code. It has to be coming from somewhere, right? How would you go about finding out where?
I've seen this when you have a web control in a page where there is invalid HTML. If your codebehind is trying to do something with the control, it won't be able to find it and will give you Object Reference... error at compile time. In my experience, it doesn't create a runtime error, and the project will build if the file in question is closed at the time of build. HTH, Good Luck!
Run this command at the command line and see if you get some more detailed information
%WINDIR%\Microsoft.NET\Framework\v3.5\msbuild.exe YourSolution.sln /v:n
To follow up on this problem, we never did track down the origin of the error but it disappeared when we upgraded to Visual Studio 2008 and converted the project to a Web Application.
The first thing I'd try would be to increase the compiler verbosity. This can be set in the Visual Studio options - e.g. "Tools->Options->Projects and Solutions-Build and Run->MSBuild project build output verbosity" for VS2005. If you set it to diagnostic then it should tell you what it's doing at the time the exception is raised at the very least.
I had this problem for a long time and finally found a solution that work fine for me.
It doesn't make sense to me... but altering my web.config file with the following gets definitively rid of this intermittent build error :
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<!-- add this line below -->
<remove extension=".rdlc"/>
</buildProviders>
Hope this help !
I had this at build time when my project contained custom datasources (my own objects returning collections) with compile errors (that is, my objects had errors).
You'll also get this error if you try and add a datasource and your project doesn't have any datasources in the project's root (e.g. if you've put all your datasource classes in a subfolder). The only solution I found was to create a datasource in the project's root.
Sorry not to be more precise, but there seems to be several things that can go wrong with datasources/objects at compile-time.
An "Object reference not set to an instance of an object" is clearly a run-time error, not a compile-time error. So what that says to me is that Visual Studio is choking on something, which may not necessarily be in your code, or which something in your code is only indirectly causing.
Next question I'd ask: Does this happen only in Visual Studio, or does the same thing show up when you build using MSBuild or CSC?
What's really odd is that it's a run-time error. You shouldn't see that at compile time. Do you have any pre- or post- build steps attached to the solution? Any unit tests you're including with your 'build' process?
Where does this error show up?
Check the Application Log of your Event Viewer - It should tell you where the exception is being thrown.
Just to clarify, is it the compiler itself that is choking? Are you doing anything weird with #define and #if directives in your code? Maybe something is being done out of order at some point... Just a thought...
See if there are any post-build events that could be failing. These can be found on each project's property page.
Try using Rebuild Solution instead of Build Solution. You may need to add Rebuild Solution from Tools > Customize. If your web app installs or registers any windows services, and those services are started, Rebuilding plows through those types of problems.

Resources