Visual studio with mvvm-light toolkit crash - mvvm-light

I am building a Silverlight 4 application using Mvvm Light(latest version), and VS 2010 crashes every 5 minutes even less. So it is impossible to work.
I believe it is because I am doing or there is something wrong with my MVVM implementation.
I get this error on the designer sometimes.
An unhandled exception has occurred:
An unhandled exception has occurred: [Xml_CannotFindFileInXapPackage] Arguments: ServiceReferences.ClientConfig Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60129.0&File=System.Xml.dll&Key=Xml_CannotFindFileInXapPackage at System.Xml.XmlXapResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext) at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext) at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup() I don't know if this is related with the crash. ..And I found this error in the event viewer: Application: devenv.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ObjectDisposedException Stack: at System.Windows.Threading.Dispatcher.FastInvoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object[]) at System.Net.Browser.AsyncHelper.CheckUseLowLatencyNetworking() at System.Net.Browser.AsyncHelper.BeginOnUI(System.Threading.SendOrPostCallback, System.Object) at System.Net.Browser.BrowserHttpWebRequest.Abort() at System.ServiceModel.Channels.HttpOutput+WebRequestHttpOutput.Abort(System.ServiceModel.Channels.HttpAbortReason) at System.ServiceModel.Channels.HttpChannelFactory+HttpRequestChannel+HttpChannelAsyncRequest.AbortSend() at System.ServiceModel.Channels.HttpChannelFactory+HttpRequestChannel+HttpChannelAsyncRequest.OnSendTimeout(System.Object) at System.Threading._TimerCallback.TimerCallback_Context(System.Object) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading._TimerCallback.PerformTimerCallback(System.Object)
Any help will be appreciated, thanks in advance.

Most of the times the reason why Visual Studio crashes in WPF and Silverlight applications is that it has difficulty in loading Xaml in design view. It is usually because of an error in XAML.
To prevent this issue from occuring:
Go to Tools / Options
Text Editor -> XAML -> Miscellaneous
Check the option "Always open documents in full XAML view".
Resolve the error in xaml
Uncheck the option mentioned in point#3 to see XAML in design view.

I had and fixed this problem. My symptoms were: I was having a Silverlight application that wasn't running correctly or was crashing frequently. While debugging, VS2010 frequently crashed with the exact same backtrace as above.
I was mis-initializing an object (trying to connect to an improperly formatted WCF service through a static Service object).
return (new ServicesClientVar.Service(new Binding(),
new EndpointAddress(new Uri("http://:8000/FileServices"))));
If you look at the Uri it is misconfigured.
SO, I'm not sure if this was an issue with WCF service clients specifically, or if any improperly initialized static object will cause this to happen.
Hope this helps someone else out someday...

Related

sqlite3 method access exception in wp7 while storing database in isolatedstorage

I'm currently developing database app for wp7& 8 in wp8 Sdk with target Os 7.1.When i Run the Application in Wvga,wxga,720p emulator all working fine,but when i run it on 7.1 Emulator,An unhandled exception of type 'System.MethodAccessException' occurred in Community.CsharpSqlite.WinPhone.dll exception is Thrown at the sqlite.cs file in return the code (Result)Sqlite3.sqlite3_open_v2(filename, out db, flags, null);.Help me to solve this Problem
for reference have a look at it
Not sure if this is useful to you, but I fixed this problem in the end by, well, switching to csharp-sqlite :)
You may also peek into sqlite-net sources and remove the offending call, but the csharp-sqlite project has more activity and generally less problems.

ASP.net MVC4 WebAPI JSON Medium Trust

So, I've been playing with ASP.net MVC4 and the new WebAPI the past few days. One of the first things I always do when starting a new app is throw <trust level="Medium" /> into my Web.config so I can be sure my app will run on most hosts.
Usually, if I use the stock Microsoft stuff everything works without a problem. But tonight I was having problems following Brad Wilson's Webstack of Love presentation. All of my AJAX calls were returning a Server 500 error. However, when I would hit the WebAPI directly in the browser, it would return everything in XML format.
So I assume the serialization to JSON withing the WebAPI controller is what is causing the issue. My question is how to work around this?
It bothers me that Microsoft teaches shared hosts to play it safe and lock things down to Medium Trust, then creates new web technology that won't work in Medium Trust. Maybe everything will be fine when it is a final release and the binaries are installed in the GAC? It can take months for shared hosts to upgrade to the latest and greatest.
It seems like the biggest problem is usually Reflection--90%+ of the stuff I've tried that won't run on Medium Trust is due to this (For instance, I'd love to use AutoMapper instead of hand-coding ViewModel => Entity mappings). Is there a way to confine Reflection to the assemblies within an app so it can become part of the Medium Trust feature set and make this problem a thing of the past?
I set up Failed Request Tracing on IIS when I found that the Application_Error event wasn't even firing in my Global.asax. This is the exception being thrown. Not sure how to get any more details.
Warning -MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName ManagedPipelineHandler
Notification 128
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode The operation completed successfully. (0x0)
Link to sample project displaying the issue. Also enclosed in the base "Test" directory are screenshots of my fiddler tests: XML-fiddle.png & JSON-fiddle.png.
Web API works just fine in medium trust. Also, since RC version, it 's not deployed to GAC anymore. You can just xcopy Web API dlls onto the server and reference them (or simply just publish your project from VS or git publish it if your host support it, like Azure).
You mention web stack of love. Well, it is SignalR that doesn't work in medium trust mode. See here - according to David Folwer, it won't anytime soon https://github.com/SignalR/SignalR/issues/364
Finally, if you are getting error 500s always add this to Global.asax
GlobalConfiguration.Configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
to receive verbose errors.
My problem had to do with the serializing of Entities with circular relationships (in this case Countries => States, State => Country). The JSON serializer was unable to handle this which led to a 500 error when requesting JSON.
I often use Entities directly for mocking things up and getting a prototype. I always planned on using distinct View Models anyway, but I wanted to understand what was going on and why it was failing.
Kiran Challa's answer in my ASP.net forums question helped me get the error that was occuring: "The RelationshipManager object could not be serialized. This type of object cannot be serialized when the RelationshipManager belongs to an entity object that does not implement IEntityWithRelationships."
That then led me to the Serializing Circular References with JSON.Net and Entity Framework on johnnycode.com.

flex write runtime errors stacktrace to file

I am developing a Flex + AIR application. While debugging using Flash Builder sometimes I get runtime errors dialog with 'continue' & 'dismiss all' buttons. But when I release a build(.air) & run the application after installing. Then I don't get the same dialog in the release build.
I need to track these types of runtime errors for that I am trying to write them to a file as logs.
I tried using try catch & writing to file in catch block, but I am not able to get any wayout for unhandled exceptions or runtime errors.
Is there any way to achieve it?
Thanks in advance.
The error dialog is displayed only if you use the debugger version of Flash Player.
You could register an UncaughtErrorEvent handler and log the errors with trace or with the logging API:
private function onApplicationComplete():void
{
loaderInfo.uncaughtErrorEvents.addEventListener(
UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError);
}
private function onUncaughtError(event:UncaughtErrorEvent):void
{
trace(error);
}
You can't debug compiled AIR application with the Flash debug player because the debug information is removed when you make a release build. You can use something like De MonsterDebugger to output error information, but generally it's a bad idea to show error info in a release build. You should be testing prior to releasing.
In Flash 11.5+ it is now possible to get the stack trace at runtime using error.getStackTrace() see http://renaun.com/blog/2012/09/getting-the-stack-trace-in-a-release-flash-player/
It is working for me in an Air application.

How to solve "NullPointerException" with "Server.processing" error while we are using Flex Builder 3 and BlazeDS?

I am using Flex builder 3, BlazeDS, and Java with Spring and Hibernate framework. I using the remote object to load a string from spring's configuration files. But in testing, I found this fault event like this:
RPC Fault
faultString="java.lang.NullPointerException"
faultCode="Server.Processing"
faultDetail="null"
I have checked the configuration in remote-config.xml and services-config.xml. But it looks good. Some people have talked about this problem around the Internet and I think you can help me and them.
I am using these environment:
Flex Builder 3
BlazeDS 3.2.0
JBoss server
Full stacktrace:
[RPC Fault faultString="java.lang.NullPointerException" faultCode="Server.Processing" faultDetail="null"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:220]
at mx.rpc::Responder/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53]
at mx.rpc::AsyncRequest/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]
at NetConnectionMessageResponder/statusHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:569]
at mx.messaging::MessageResponder/status()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:222]
The java.lang.NullPointerException indicates an error being thrown on the server. To debug this, active debug logging on BlazeDS in the services-config.xml file. You should see detailed debug information in the server console.
When using the BlazeDS/Spring integration take care that you will need to use a custom exception translator in order to obtain meaningful exceptions. Please read this document http://static.springsource.org/spring-flex/docs/1.0.x/reference/html/ch02s08.html
In your case the error is not related to some configuration problems, it seems that is thrown inside your java method. Use a debugger in order to diagnose properly.

Exception that goes away with Clean/Rebuild. How to diagnose/prevent?

Pre-Problem: our office was hit by a worm due to a corporate patching oversight, and the boys in the lab repaved my machine. I needed to re-install all my development tools (Visual Studio 2005, SP1, and the Web Application Project Setup patch) again. The following problem did not occur before this event.
I've been working on an ASP.NET web application project for several months now. I've been editing, debugging, etc without a problem. Then, I added a single line of code, ran it in Debug and got this error:
System.Web.HttpUnhandledException:
Exception of type 'System.Web.HttpUnhandledException'
was thrown.
System.IO.FileLoadException: The given assembly name
or codebase was invalid. (Exception from HRESULT: 0x80131047)
I uncommented the new code, built the project and ran in debug again, but got the same error.
New Code:
Me.frm.btnSubmitChanges.Attributes.Add("onclick", "javascript:return validateSubmit();")
The only way I've been able to fix this is to Clean, then Rebuild the project. I haven't been able to trap where it's happening using breakpoints.
It's happened a couple times in the last few days. What should I be looking at to fix this?
Thank you!
Have you tried to enable Fusion Logger to see if it's an assembly that is failing to load? In C# you can tell the debugger to break at any exception (There's a command you can add by customizing the tool bar called Exceptions). I'm not sure if VB has this but I would assume they do. Can you tell it break on FileLoadException and that might help you understand what's going on.
The line of code you added is pretty innocuous. When you add the code it breaks, have you then done a clean build with that line of code still in and does it work or not?
I did run the Fusion Logger, but did not get any results when the exception occurred. I tried all 4 settings.
The new line of code runs fine after a clean/rebuild.
I haven't used the break on all exceptions before; I'll see if I can find it.

Resources