Visual Studio 2013 Keeps Crashing with Web Essentials - visual-studio-2013

I have integrated Typescript + Web Essentials into my project, on which I've worked with VS 2012 so far.
I had a problem with typescript that did not compile on save and I edited my csproj according to this question, which solved my problem.
The other day I installed VS2013, installed Web Essentials 2013 and since then everytime I load my solution VS2013 crashes.
If I uninstall Web Essentials, everything works fine.
I tried removing the text I had edited into the csproj but to no avail.
This is the problem's details I get from the crash:
Problem Event Name: CLR20r3
Problem Signature 01: devenv.exe
Problem Signature 02: 12.0.30110.0
Problem Signature 03: 52cfb65a
Problem Signature 04: Microsoft.VisualStudio.Platform.VSEditor
Problem Signature 05: 12.0.21005.1
Problem Signature 06: 524fcbc8
Problem Signature 07: 2e6
Problem Signature 08: 19
Problem Signature 09: System.NullReferenceException
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Not much idea as to how to fix this issue.
EDIT: I've noticed the crash happens only when I open a .ts file. The solution kept insta-crashing since there were .ts files opened already. I disabled Web Essentials, closed them all, enabled WE and then the solution opened without the crash. Then opening a .ts file triggered the crash.
Here is the stack trace:
> Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Utilities.Implementation.ContentTypeRegistryImpl.GetContentType(string typeName) Unknown
WebEssentials2013.dll!MadsKristensen.EditorExtensions.Margin.TextViewMargin.CreateTextViewHost(string contentType) Unknown
WebEssentials2013.dll!MadsKristensen.EditorExtensions.Margin.TextViewMargin.CreatePreviewControl(double width) Unknown
WebEssentials2013.dll!MadsKristensen.EditorExtensions.MarginBase.CreateMarginControls() Unknown
WebEssentials2013.dll!MadsKristensen.EditorExtensions.CompilingMarginBase.CreateMarginControls() Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown

For any seekers - install VS 2013 Update 2 and it will not crash anymore.

Related

Android app crashes right away after being downloaded from google play store

I have created a Android app which runs perfectly fine when I debug it in Visual Studio 2019 on my Android phone.
But when I publish it to the Google Store and download it and run it on the same phone it crashes right away.
The stack trace is:
android.runtime.JavaProxyThrowable: at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) <0x7e57beb580 + 0x006f0> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) <0x7e57be9354 + 0x00053> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshTinyIoC.FreshTinyIoCContainer.ResolveInternal (FreshTinyIoC.FreshTinyIoCContainer+TypeRegistration registration, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) <0x7e57beade0 + 0x006ff> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshTinyIoC.FreshTinyIoCContainer.Resolve (System.Type resolveType) <0x7e57be85d4 + 0x00083> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshTinyIoC.FreshTinyIoCContainer.Resolve[ResolveType] () <0x7e57be8668 + 0x0003b> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshMvvm.FreshTinyIOCBuiltIn.Resolve[ResolveType] () <0x7e57b810c0 + 0x00047> in <d2b205c381d14059b4260d7482e68c02>:0
at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] (System.Object initData) <0x7e57b80c90 + 0x00057> in <d2b205c381d14059b4260d7482e68c02>:0
at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] () <0x7e57b80c54 + 0x00033> in <d2b205c381d14059b4260d7482e68c02>:0
at GoTexas.App.InitNavigation () <0x7e57b426f4 + 0x00037> in <dd7679dd949e46e680e37995753481d2>:0
at GoTexas.App..ctor () <0x7e57b42600 + 0x0009f> in <dd7679dd949e46e680e37995753481d2>:0
at GoTexas.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) <0x7e54f0b75c + 0x0010f> in <a02812a7c00f4c1c87e549cce19fa824>:0
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) <0x7e598ad064 + 0x0007b> in <899f47c5cea3409e92f041348b58600b>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.7(intptr,intptr,intptr)
at md5b9bd3a38d4378f5ce9f0aa132dfd154f.MainActivity.n_onCreate (Native Method)
at md5b9bd3a38d4378f5ce9f0aa132dfd154f.MainActivity.onCreate (30)
at android.app.Activity.performCreate (Activity.java:7327)
at android.app.Activity.performCreate (Activity.java:7318)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3094)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3257)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1948)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7050)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:964)
So it has something to do with FreshTinyIoC. I just don't get why this works when running off VS 2019 in debug mode off my phone.
Any ideas would be greatly appreciated.
The issue is quite simple actually you have set linking to SDK & User Assemblies which means it is linking everything, your models and every other class, anything that does not have a reference will be collected and removed for better understanding you can check my blog which has an entire section on how to work with Linking:
https://heartbeat.fritz.ai/reducing-the-app-size-in-xamarin-deep-dive-7ddc9cb12688
As of now, I would suggest you can check Link SDK Assemblies for now and then you can Link everything as that takes a little time
Goodluck, Feel free to get back in case of queries

Xamarin.Forms - MONO_GC_PARAMS=bridge-implementation=old - how to tell if it's working on Windows?

I'm seeing this cryptic exception that's been documented on bugzilla.xamarin.com periodically. Most of the posts suggest you can suppress the error by changing the bridge implementation to the Old version instead of Tarjan by setting an environment variable:
MONO_GC_PARAMS=bridge-implementation=old
I set the variable, but I don't see anything in my logcat or build output to indicate it's using one bridge or the other, and I'm still getting the exception. Is there a way to tell which implementation is being used?
Here's the stack trace - any suggestions are greatly appreciated.
Process: com.icon.iconsurvey, PID: 11543
android.runtime.JavaProxyThrowable: System.ArgumentException: Handle must be valid.
Parameter name: instance
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00009] in <7cfbebb561c54efc9010b018c0846c7e>:0
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (System.IntPtr jobject, System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x00015] in <e975227ac8644a30bb0866117325de0d>:0
at Android.Support.V4.Widget.DrawerLayout.RemoveDrawerListener (Android.Support.V4.Widget.DrawerLayout+IDrawerListener listener) [0x00088] in <fc4222de5c684a9abf7cc4821baac4cd>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.Dispose (System.Boolean disposing) [0x000e4] in <b5b1173f4d49442b898c45e26ae39e48>:0
at Java.Lang.Object.Dispose () [0x00000] in <e975227ac8644a30bb0866117325de0d>:0
at Xamarin.Forms.Platform.Android.AppCompat.Platform+<>c__DisplayClass35_0.<SetPage>b__0 () [0x00015] in <b5b1173f4d49442b898c45e26ae39e48>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <e975227ac8644a30bb0866117325de0d>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <e975227ac8644a30bb0866117325de0d>:0
at (wrapper dynamic-method) System.Object:1d7dae73-d3c1-4d29-aa82-708ecaa93ad1 (intptr,intptr)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
The current suggestion is using new rather than old when changing the default GC Bridge away from tarjan. You may have been told to use the "old" default which was technically new before changing to tarjan in Mono 4.6:
http://www.mono-project.com/docs/about-mono/releases/4.6.0/#new-default-gc-bridge-processor-on-android
You can see if this is being picked up by checking the Diagnostic Build Output of your project.
https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output
You would then look to ensure the configuration file is picked up with the respective arguments.

Link all in Xamarin release,failed with Autofac Assembly

When setting the Linker behaviour to "Link all" I get the following error at runtime:
Autofac.Core.DependencyResolutionException.
I've tried adding ignore assembly Autofac but without success.
Setting the Linker behavior to "Link Framework SDKs only" does work but I want to enable "Link All" if possible.
Thanks in advance.
Update :
ReflectionActivator.ActivateInstance (Autofac.IComponentContext context, System.Collections.Generic.IEnumerable`1[T] parameters)
Autofac.Core.DependencyResolutionException: No constructors on type 'Eela.Taxi.Service.RestService' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.
No constructors on type 'Eela.Taxi.Service.RestService' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = RestService (ReflectionActivator), Services = [Eela.Model.Xamarin.Interfaces.IRestService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> No constructors on type 'Eela.Taxi.Service.RestService' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'. (See inner exception for details.)
1
ReflectionActivator.ActivateInstance (Autofac.IComponentContext context, System.Collections.Generic.IEnumerable`1[T] parameters)
2
InstanceLookup.Activate (System.Collections.Generic.IEnumerable`1[T] parameters)
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = RestService (ReflectionActivator), Services = [Eela.Model.Xamarin.Interfaces.IRestService], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> No constructors on type 'Eela.Taxi.Service.RestService' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'. (See inner exception for details.)
1
InstanceLookup.Activate (System.Collections.Generic.IEnumerable`1[T] parameters)
2
InstanceLookup.Execute ()
3
ResolveOperation.GetOrCreateInstance (Autofac.Core.ISharingLifetimeScope currentOperationScope, Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
4
ResolveOperation.ResolveComponent (Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
5
ResolveOperation.Execute (Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
6
LifetimeScope.ResolveComponent (Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
7
Container.ResolveComponent (Autofac.Core.IComponentRegistration registration, System.Collections.Generic.IEnumerable`1[T] parameters)
8
ResolutionExtensions.TryResolveService (Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable`1[T] parameters, System.Object& instance)
9
ResolutionExtensions.ResolveService (Autofac.IComponentContext context, Autofac.Core.Service service, System.Collections.Generic.IEnumerable`1[T] parameters)
10
ResolutionExtensions.Resolve (Autofac.IComponentContext context, System.Type serviceType, System.Collections.Generic.IEnumerable`1[T] parameters)
11
ResolutionExtensions.Resolve[TService] (Autofac.IComponentContext context, System.Collections.Generic.IEnumerable`1[T] parameters)
12
ResolutionExtensions.Resolve[TService] (Autofac.IComponentContext context)
13
App+<OnStart>d__4.MoveNext ()
14
ExceptionDispatchInfo.Throw ()
15
AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state)
16
SyncContext+<>c__DisplayClass2_0.<Post>b__0 ()
17
Thread+RunnableImplementor.Run ()
18
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
19
(wrapper dynamic-method) System.Object:f9684b08-49ee-4f47-8b7c-c59b675c18f3 (intptr,intptr)
So as your Stack Trace indicates. Autofac is trying to instantiate an instance of Eela.Taxi.Service.RestService. However, it seems like the Mono Linker has removed the constructor because it is never directly invoked.
So you could do a couple of things. You could:
Add your assembly to be ignored from the linker
You could add a [Preserve] attribute on your RestService to tell the Linker not to touch it
You could similar to what MvvmCross does have a LinkerPleaseInclude.cs file which describes usage of each type that get stripped out. So for every one you discover you will need to add it here.
So 1. and 2. are fairly self explanatory. You have already used 1. for autofac, just do the same for your own assembly containing RestService. However, the downside here is that nothing in this assembly will be linked, potentially leaving you with a lot more code in it than actually needed.
For 2. you simply add [Preserve] right before declaring your class. So something like:
[Preserve]
public class RestService : IRestService { }
You may also consider using it with AllMembers = true: [Preserve(AllMembers = true)] to keep member fields too.
As for the last option. You basically create a LinkerPleaseInclude.cs in your App project. You let the linker do its job. You continue adding stuff to the class until the Linker does kill your App at runtime. So a start on LinkerPleaseInclude.cs could look like:
[Preserve(AllMembers = true)]
public class LinkerPleaseInclude
{
public void Include(IRestService service)
{
service = new RestService();
}
}
This class is never invoked, but it is enough for the linker to know that the constructor of RestService should not be linked out.

Cannot delete Custom Entities and it's not about relations

I created a fresh new entity which has no additional fields or relations to anything and also without any records.
Just after i created the entity and when i try to delete it, it gives me the following error:
An error has occurred.
And in the log file which can be downloaded from the error dialog:
System.ArgumentNullException: Value cannot be null. Parameter name: collection
And when enabled tracing the error was:
Process: w3wp |Organization:0220cef0-4f09-e711-80d8-000c2950db72 |Thread: 244 |Category: Platform.Metadata |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 17d8623e-7539-48af-9652-b8550acfb76f | EntityService.Delete ilOffset = 0x1A8
>EntityService.Update caught exception: System.ArgumentNullException: Value cannot be null.
Parameter name: collection
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at Microsoft.Crm.BusinessEntities.CascadeEngine.LogRecordSetCount(Int32 count, IEnumerable`1 entityIds, Int32 parentEntityObjectTypeCode, String perfCounterName)
at Microsoft.Crm.BusinessEntities.CascadeEngine.CascadeDeleteDB(IEnumerable`1 parentEntityIds, Int32 parentEntityObjectTypeCode, ExecutionContext context)
at Microsoft.Crm.BusinessEntities.CascadeEngine.Delete(IEnumerable`1 entityIds, Int32 entityObjectTypeCode, ExecutionContext context)
at Microsoft.Crm.BusinessEntities.CascadeEngine.DeleteAll(Int32 entityObjectTypeCode, ExecutionContext context)
at Microsoft.Crm.Metadata.EntityService.Delete(Guid entityId, MetadataHelper metadataHelper, Boolean suppressSecurityCacheFlush, ExecutionContext context)
Well i don't know whats wrong. Please let me know if you know anything. Thanks.
One thing to check is if there are any dependencies, which you can do by selecting the entity in a solution and clicking Show Dependencies:
I did noticed something that this error only happens when Persian language pack is installed, but when its just CRM with no language packs everything is fine.
So at least i know what to do now and it's not something useful to be discussed further here.
Thanks.

Why is HttpNotificationChannel.Open throwing ArgumentException() E_INVALIDARG?

Here is my code. Everything works fine the first time I run it, i.e. HttpNotificationChannel.Find() returns null.
But the second time I run it, Find() returns the proper thing, however when I get to the Open() call, it throws an exception. Which is really odd, since Open() doesn't take any arguments.
What am I doing wrong?
public string ChannelName = "MyAppChannel";
...
NotificationChannel = HttpNotificationChannel.Find(ChannelName);
if (NotificationChannel == null)
{
NotificationChannel = new HttpNotificationChannel(ChannelName);
}
NotificationChannel.ChannelUriUpdated += new EventHandler(Channel_ChannelUriUpdated);
NotificationChannel.HttpNotificationReceived += new EventHandler(NotificationChannel_HttpNotificationReceived);
NotificationChannel.ErrorOccurred += new EventHandler(Channel_ErrorOccurred);
NotificationChannel.Open(); // <-- Kaboom here, the 2nd time
Here's the full text and stack:
System.ArgumentException: E_INVALIDARG
at Microsoft.Phone.Notification.SafeNativeMethods.ThrowExceptionFromHResult(Int32 hr, Exception defaultException, NotificationType type)
at Microsoft.Phone.Notification.HttpNotificationChannel.Open()
at LiveShare.NotificationManager.Initialize()
at LiveShare.App..ctor()
at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at MS.Internal.TypeProxy.<>c__DisplayClass30.b__2a()
at MS.Internal.TypeProxy.CreateInstance(UInt32 customTypeId)
at MS.Internal.FrameworkCallbacks.CreateKnownObject(IntPtr nativeRootPeer, UInt32 customTypeId, String initializationString, IntPtr& nativePeer, UInt32 isCreatedByParser)
at MS.Internal.FrameworkCallbacks.CreateUnknownObject(String assemblyName, String typeName, IntPtr nativeRootPeer, String initializationString, UInt32& customTypeId, UInt32& coreTypeId, UInt32& typeFlags, IntPtr& nativePeer)
The correct solution is not to call Open() if Find() succeeds.
This looks very similar to a documented problem with the CTP as described by Nick Harris last April.
Solution: If you try to Open a channel almost immediately after you hit Debug when emulator fires up this issue will occur. The solution is simple – Give the emulator two minutes before making the call.
In case that's not it, there's a good article on Silverlight Show that covers push notifications in a WP7 stock quote app.

Resources