I'm having a very odd problem.
We wrote a Windows Phone 8.1 app, and upgraded it to UWP. The debug version of the app works great, however, when I run it in release, I get this error:
Internal.Runtime.TypeLoader.TypeBuilder+MissingTemplateException: Exception of type '{0}' was thrown., Internal.Runtime.TypeLoader.TypeBuilder+MissingTemplateException. For more information, visit http://go.microsoft.com/fwlink/?LinkId=623485
When trying to open a specific ViewModel (working with MvvmCross). It happens only to this ViewModel, though it doesn't seem special in any way.
Note that I'm compiling it with .NetNative enabled. If I disable it, it works fine, but I can't release the app to the store without it.
Any help would be greatly appreciated.
That's one of the runtime exceptions in .NET Native. Most likely you can work around this by adding something to your Default.rd.xml file.
To properly diagnose this I'd recommend enabling .NET Native compilation for the DEBUG configuration of your project (Project properties > BUILD > Enable .Net Native checkbox). Then, set your debugger to stop on first chance exceptions.
If you can move to Update 1, the messages are a bit better.
After digging in a bit, I'd love to know what it ends up being. It's pretty uncommon to hit this type of error so it would be great to know places where we can be better. You're always welcome to send specific feedback to us at dotnetnative#microsoft.com.
It appears the problem was that the offending ViewModel had an Init method that returned a Task:
public async Task Init(...)
Fixed by changing it to void:
public async void Init(...)
Not quite sure why, but it works...
Related
I'm attempting to make a Windows forms application and compile it with CoreRT. When the app is simple, compilation works correctly; everything is compiled and the managed code is converted into natiive. However, if I do more than add a couple of buttons to the form, e.g. "Changing the icon", the application won't run when compiled? If anyone knows why, please let me know! Thanks.
The only code written was "MessageBox.Show(DateTime.Now.ToString(), "Current Date Time Native", MessageBoxButtons.OK, MessageBoxIcon.Information);" The problem I'm having is that the application compiles and runs only when basic controls are used. As soon as I add an icon to the application when I compile and try to run it, nothing happens. It doesn't even start.
The only thing I'm able to do in order to get the application to compile and run is add simple controls such as buttons and labels from the .NET toolbox. Adding something such as an Icon, or even changing the name results in the application compiling but when I try to run it, it doesn't start.
Short answer: no. Long answer, check https://github.com/dotnet/corert/issues/7995 for a list of partially working controls, most are missing as COM support is missing from CoreRT at present.
I'm aware of several existing questions on this topic, but they either don't have answers, or the answers don't work for me, so I'm trying again here.
I am attempting to use the Java Access Bridge API in a WinForms C# project. Both Java Ferret and Java Monkey work fine, which tells me that the bridge is installed and at least capable of functioning. However, when I try to run isJavaWindow() in my own code, it always returns false. I've tried other solutions that have recommended placing the Windows_run() code in the form constructor, but this has no effect for me.
It's worth noting that the code below DOES work for me on my home PC, but does not work on my work PC. It also works for a coworker, but only if he runs the executable directly - if he tries to run it from Visual Studio, it doesn't work there either.
Any help would be appreciated. I've been pulling my hair out over this for several days now, and have exhausted every possibility that I've come across in Google or elsewhere.
JabApi.Windows_run();
Application.DoEvents();
string windowName = "SwingSet2";
string className = "SunAwtFrame";
IntPtr hWnd = JabApi.FindWindow(className, windowName);
//This always returns false (0), even though it's pointing to a valid Java window
if (JabApi.isJavaWindow(hWnd)==1)
{
MessageBox.Show("Java window found!");
}
I'll answer my own question here.
The issue turned out to be that I was running Visual Studio as Administrator. When I tried running VS with normal privileges, the Java Access Bridge code immediately began working as expected.
The executable itself was running into a similar issue. When I previously ran the executable outside of VS, it turned out I was running it from a location with elevated privileges. When I moved the executable to a normal location, it worked as expected.
The isJavaWinndow() method also returns false if the Access bridge dll referenced has a mismatch with the application's bit version. Make sure to reference the 64-bit dll version for your 64 bit application (or 32 bit version if otherwise).
I've got stumped by problem during development of my ASP.NET application.
I cannot debug it any more after attaching debugger to a process. Recently I was changing some windows features and checking IIS settings but as far as I remember I was able to debug my app till today.
Ok so what's going on.
I attached debugger and nothing happens no symbols are getting loaded (I am absolutely sure that Build -> Configuration and stuff looks correct in terms of debug etd). That symbols are getting generated and that app is working on dlls which I compile the only problem is that no matter what I do - symbols are not getting loaded.
I've got 2 traces which could lead me to the cause 1st:
The first one is strange application type when attempting to attach a debugger using visual studio. Normally all other apps are using Managed (v4.0......),x64 (I am right now talking about Window with all process running on computer Debug -> Attach -> type column)
but this app for some reason is using Script, Managed (v4.0......),x64
The other one is that when I've debugger attached to the application and open Debug -> Windows -> Modules the only one that is listed is:
**Script Code (Microsoft Active Server Pages) Script Code (Microsoft Active Server Pages) N/A N/A Symbols loaded. Script Code (Microsoft Active Server Pages) 1 [29896] w3wp.exe**
Which kinda looks like some precompilled stuff. (I do not recall enabling any kind of recompilation).
I've tried recreating app on IIS along with switch app pool yet it's still the same. What's even more after checking diff of web config I don't see any kind of change which could lead to such behavior.
I was working with this application for like 8 months and never had a problem like this.
Thanks in advance for your tips.
Kind Regards.
EDIT:
Images
Modules
I've had the exact same issue and could solve it by moving the site to a different application pool. The target application pool already had an application assigned which I could debug (showed up as Managed (v4.0......),x64 in process selector) and once I moved the problematic site over, I could also debug that site.
I didn't figure out what exactly causes the behavior in the first application pool but maybe this helps someone to quickly solve this problem until someone comes up with a better analysis.
I have a Silverlight project that we use internally that I wrote - and since we've not had any need to work on it, it's been a while since I've opened the project. I opened it up this morning and everything is fine in terms of building, but whenever I try to debug I get the following error:
Unable to start program "http://mymachinename/mywebsite/index.aspx"
Of course, running it in Firefox works fine but no symbols are loaded. Running without debugging still throws the same error but IE loads up anyway...
Navigating to the website in IE works fine - SL app opens up, loads data etc etc, all looks good
I've Googled this all morning (usually quite good at finding info) and been through all the questions on SO and I can't figure out what's going on - there doesn't seem to be any messages in the event log, there are no messages in any VS output window, the w3wp just terminates immediately after starting (probably due to there being an error trying to open IE). I've tried reinstalling IE, cleaning/rebuilding, using local dev server, creating a new web project, turning on/off settings in IE9 etc etc
Nothing seems to make a difference - anyone got any experiences of this and has fixed it without doing one of the things I've already done? Any other suggestions?
Thanks in advance!
UPDATE
Just to be clear in case anyone asks - I get this problem when creating a new web project - i.e. everything I said I'd tried (above) didn't change the behaviour. It showed the same error no matter what I'd done so far (that includes a NON SL web project)
I've also tried attaching the debugger to w3wp that is running (the standard IIS process) and I can't seem to get it to debug (no symbols are loading), but that might be another issue altogether. I'm going to look at that next and maybe if I figure that out it might lead to fixing this issue
UPDATE 2
Debugging in Firefox works - I attached to w3wp with no success, then realising my stupidity (SL being a client side app!) I attached to the plugin-container.exe that FF runs its plugins in. This works. I can probably do the same for IE and just attach to IE, but why won't it start up from VS?! hair pull
UPDATE 3
Just in case anyone asks, the default browser is set to IE in VS. Also I've managed to debug by attaching to IE, it just won't start IE from within VS - annoying but I can live with it for now. If anyone does have a suggestion though, feel free...
For anyone's information in case they have this same problem, it ended up being that the port I was running my site on was also running a SharePoint site!
I created a new site on port 81 and used that for dev - not sure what setting on the other site caused the issue but it ended up working on port 81.
C#, VS2010, WinForm application:
Sometimes I do have the problem that I get an error message when opening some of my controls / forms. All code compiles and the application runs properly. Opening the control in the designer gives me:
The designer loader did not provide a root component but has not indicated why.
From my experience I can tell, it is usually something in my code which does not get properly initialized, e.g. a property is not set which is somehow available at runtime, but not when opened with the designer. The only issue is, that the root cause is hard to find.
Q: Is there a chance to somehow use the debugger when the designer opens my component in Visual Studio 2010? That would help a lot and the problem tackling is most likely a matter of minutes then.
Remark: Just to make this clear, I know how to use the debugger ;-), I only have no idea how I could tell VS2010's designer to open my control in Debug mode.
As of 2nd SEP 2010 added:
Thanks for your help. Basically it is the MSDN Library article describing how to do it.
I have managed to set it up and run the second instance
(there was not much to understand how to do it).
It only fails in my case, because the 2nd VS2010 instance (debugging Design Time) fails to find the
symbols for my custom control. I have added the symbols manually under Debugging / symbols. No
result, still "Breakpoint won't be hit because of missing symbols"
BTW, using this approach it is helpful to exclude some stuff from the symbol loading (via modules window), because this will safe a lot of time.
Now if have to figure out how to get the symbols resolved and then I can tackle the issue.....
The vast majority of design time problems with custom controls are caused by code in the event handlers or method overrides in your control running at design time as well as run time. That's normally desirable, you get instant feedback when you change a property in the Properties window for example.
But not desirable when the code depends on something that's available at runtime but not design time. Like a dbase connection or a file that's stored in the build folder. That can generate exceptions and Visual Studio isn't very robust against handling exceptions at design time. Worst case, you can crash VS to the desktop without any diagnostic. But anything is possible.
Review the code in your control and make sure that the bits of code that should only run at runtime are wrapped like this:
if (!DesignMode) {
// etc..
}
Hard cases can be diagnosed with the debugging tips in this MSDN Library article.
To debug your control in design mode, you need two instances of Visual Studio. In the first instance, open the project which contains this control source code. In the Project Properties, Debugger, set command line which calls another Visual Studio instance (msdev? don't know exactly for VS2010 - take it from the shortcut), Then execute "Start Debugging" command. Another Visual Studio instance starts. In this instance open client project which uses your control on the form.