xamlparser error after clickonce deployment.Application crashing after installation - wpf

I've built an WPF application with visual studio 2008 and created an installer for it.Works fine so far.I realized it lacks the automatic updates feature, and after trying several solutions, i decided to give a try to clickonce deployment.After a successful deployment on a network server, i 've noticed that the application crashes after installation of the downloaded app.It complains about this:
Cannot create instance of 'Login' defined in assembly 'MyApplication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'MyApplication;component/login.xaml' Line 1 Position 9.
here is the stacktrace
at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
at System.Windows.Markup.TreeBuilder.Parse()
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at myApplication.App.Main()
here is just the region the debugger is pointing to
<Window x:Class="MyApplication.Login"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:MyApplication"
xmlns:UI="clr-namespace:UI;assembly=UI"
Title="My Application" Height="400" Width="550" ResizeMode="NoResize" WindowStyle="ThreeDBorderWindow" WindowStartupLocation="CenterScreen" Name="Logine" Loaded="Logine_Loaded" Closed="Logine_Closed" Icon="orLogo.ico">
But the installer version as in the msi from setup project works fine.so i cannot see where the error is comming from since i can have design view.
Question 1 : Does any one have a similar issue, or is that a known issue?
Question 2 : If it's a known issue then what are alternative.I might give up on the clickonce but then i my automatic update feature will be lost (as in there is none which is not ovekill or seriously outdated that i can find right now).
thanks for reading this and for pointing me to the right direction.

If you go to the ClickOnce cache and find the executable for your application and double-click on it, does it still fail? If so, then it is not a ClickOnce problem per se. It could be that you are missing some assembly in your deployment that is required. Or you are doing something that ClickOnce doesn't allow, such as accessing a folder that requires administrative privileges.
You can also try running it from your \bin\release folder after doing a build, but that won't tell you if you have an assembly on your machine that you're using that is not being deployed.
The ClickOnce cache on windows 7 (and vista) is here:
C:\Users\username\AppData\Local\Apps\2.0\obfuscatedfolder\obfuscatedfolder
From there, for a win forms app, it creates two folders, one called xxxx...exe_etc and one called xxxx...tion_etc... The one that starts with xxxx_tion (where xxxx = 1st four characters of your assembly name) is the one where the app is run from. I'm not sure if the folder names are the same for a WPF app, but hopefully they're not too different. The executable will only be in one folder. (And yes, you'd think it would be in the xxxx...exe_etc folder, but it's not.)
EDIT -- ADDED INFO
For the issue of missing images: Are they included in the project as files? If so, make sure the build action is 'content' and the 'copy to output directory' property is set to 'copy always'. Otherwise, it won't include them in the deployment.
For the database, same issue. It needs to be included in the project, and the properties must be set accordingly (set 'copy...' to 'copy if newer'). ALSO, open the Application Files dialog and see if it is marked as Include(Data). If it is, then it is being deployed to the Data directory. If you deploy it that way, when you publish a new version, it will copy the data forward to the new folders. You can find it programmatically using the ApplicationDeployment.DataDirectory property.
I generally don't recommend trusting your data to ClickOnce. If you deploy something as data, and the date/time stamp on your local version changes, ClickOnce will deploy the new version, and put the old version in a subfolder called .\pre. To me, this is dangerous, because you could modify the data accidentally. SQLCE changes the date/time stamp if you just open the database to look at the table structures. So I move the data and handle the updating of the database myself. If you want more information about this, check out my blog post on keeping your data safe from ClickOnce updates.

Related

UnresolvedAssemblyException in Blend for VS design view ONLY - works fine in VS design view

.NET Framework: 4.5.1
I'm getting a curious error in Blend for visual studio 2015 which I cannot find the source of.
If I open my WPF solution in VS, it loads and runs fine. The design view also works.
However, if I open my WPF solution in Blend, whenever I open any of my .xaml files in the designer, they load briefly (for about a second)and then throw the following error:
Microsoft.MetadataReader.UnresolvedAssemblyException
Type universe cannot resolve assembly: System.Runtime, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
at Microsoft.MetadataReader.SimpleUniverse.Microsoft.MetadataReader.ITypeUniverse.ResolveAssembly(AssemblyName name)
at Microsoft.MetadataReader.SimpleUniverse.Microsoft.MetadataReader.ITypeUniverse.ResolveAssembly(Module scope, Token tokenAssemblyRef)
at Microsoft.MetadataReader.MetadataOnlyModule.ResolveTypeRef(ITypeReference typeReference)
at Microsoft.MetadataReader.MetadataOnlyTypeReference.GetResolvedTypeWorker()
at Microsoft.MetadataReader.TypeProxy.GetResolvedType()
at Microsoft.MetadataReader.TypeProxy.GetHashCode()
at System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
at System.Collections.Concurrent.ConcurrentDictionary`2.TryGetValue(TKey key, TValue& value)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlPlatformMetadata.GetType(Type type)
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.TypeResolver.GetType(String key, IAssembly assembly, Type type)
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.TypeResolver.GetType(Type type)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlProjectMetadata.GetType(Type type)
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.ProjectContextType.Cache()
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.ProjectContextType.Initialize(IXmlNamespace xmlNamespace, Type type)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockType.Initialize(IXmlNamespace xmlNamespace, Type type)
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.TypeResolver.GetType(String key, IAssembly assembly, Type type)
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.TypeResolver.GetType(Type type)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlProjectMetadata.GetType(Type type)
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.ProjectContextType.Cache()
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.ProjectContextType.Initialize(IXmlNamespace xmlNamespace, Type type)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.MockType.Initialize(IXmlNamespace xmlNamespace, Type type)
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.TypeResolver.GetType(String key, IAssembly assembly, Type type)
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.TypeResolver.GetType(Type type)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlProjectMetadata.GetType(Type type)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Tools.Assets.AssemblyAssetProvider.SynchronizedInitialize()
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Tools.Assets.AssemblyAssetProvider.UpdateAssets()
at Microsoft.VisualStudio.DesignTools.Designer.Tools.Assets.AssetProvider.Update()
at Microsoft.VisualStudio.DesignTools.Designer.Tools.Assets.AssetLibrary.UpdateAssetProvidersWorker()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority)
at Microsoft.VisualStudio.DesignTools.Platform.Utility.UIThreadDispatcherHelper.Invoke(DispatcherPriority dispatcherPriority, Action action)
at Microsoft.VisualStudio.DesignTools.Designer.View.DesignTimeResourceResolver.Resolve(IDocumentContext documentContext, EditDesignTimeResourceModelMode mode, String missingResourceName) ........etc
If I debug this in Visual studio (attach to the blend.exe process) I get the following error:
Exception thrown: 'System.IO.DirectoryNotFoundException' in mscorlib.dll
Additional information: Could not find a part of the path '<path to my project>\Design\projectGuides.guides'.
This "Design" folder doesn't exist and I don't know where it's getting requested from. I dont have any guides defined across my entire project or anything like that.
Also, I can't see any connection between these two messages.
Any tips or ideas would be greatly appreciated!
Solution
So the solution to this became clear when I updated to .NET framework 4.6. The Exception became something that returned something useful in a search:
Cannot add additional fields to a type that does not have a constructor
The first result when I searched for this was Corrado's Blog, where I was directed to a setting in Tools > Options > XAML designer, and then tick the "Run project code in XAML Designer (if supported)" option.
No problems since then. Hope this helps someone else at some point.
Funny, my Blend version does not have the option. The rest of the window looks equal, only the mentioned option is missing :/.
But it is possible to click the 2nd option in the excpetion dialog: Click here to enable running project code and reload the designer.
The option can also be deactivated via a small toggle button at the lower left corner of the designer window:
See here for further explanation.
I was facing the similiar problem in BLEND. View in Visual Studio was running fine.
I was getting this exception:
Type universe cannot resolve assembly: System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
So Designer in BLEND was showing view for 1-2 sec and then threw the exception.
My solution for this problem was:
I opened up my VS csproj file and found out that somehow another line appeared in references and I didn't know why, because I haven't use Unit Tests yet. Reference as follows:
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
After commenting it out, designer didn't throw this exception anymore.
So I hope it might help someone currently looking for the solution :)

DNN exception on Site Settings or Host Settings pages "Could not load file or assembly 'protobuf-net"

I upgraded my DNN from version 7.0.0 to 7.1.1. After that I'm getting an exception every time that I enter page Site Settings or Host Settings of DNN in my site. The exception is:
Could not load file or assembly 'protobuf-net, Version=2.0.0.447, Culture=neutral, PublicKeyToken=257b51d87d2e4d67' or one of its dependencies. The system cannot find the file specified.
Here is the full Inner Exception:
DotNetNuke.Services.Exceptions.PageLoadException: Could not load file or assembly 'protobuf-net, Version=2.0.0.447, Culture=neutral, PublicKeyToken=257b51d87d2e4d67' or one of its dependencies. The system cannot find the file specified.
---> System.IO.FileNotFoundException: Could not load file or assembly 'protobuf-net, Version=2.0.0.447, Culture=neutral, PublicKeyToken=257b51d87d2e4d67' or one of its dependencies. The system cannot find the file specified.
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable)
at System.Reflection.CustomAttribute.IsDefined(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(Type type, ICompositionElement origin)
at System.ComponentModel.Composition.Hosting.TypeCatalog.get_PartsInternal()
at DotNetNuke.ExtensionPoints.SafeDirectoryCatalog..ctor(String directory)
at DotNetNuke.ExtensionPoints.ExtensionPointManager.get_MefCompositionContainer()
at DotNetNuke.ExtensionPoints.ExtensionPointManager.ComposeParts(Object[] attributeParts)
at DotNetNuke.ExtensionPoints.EditPagePanelExtensionControl.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
I have already searched everything about protobuf-net and DNN but I have not found anything.
Anyone know anything about it?
EDIT
Finally, problem solved. The problem was a module that I installed that reference the protobuf-net. The module calls ZeneXa Newsletter Autoresponder. Somehow this module is not compatible with DNN versions newer than 7.0.0. I contacted the module for more information about that.
I have absolutely no knowledge of how DNN is making use of this, but at the simplest level you could try adding a reference to an appropriate version of protobuf-net (probably from NuGet is the simplest), and see if it works. This can be done via the UI or in the package manager console:
PM> Install-Package protobuf-net
If the problem is actually "fusion", then a binding redirect may help - for example, to redirect everything to r668 (assuming you are using protobuf-net r668):
<dependentAssembly>
<assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.668" newVersion="2.0.0.668" />
</dependentAssembly>

WSDualHttpBinding in WPF not responding

I have problem with using WCF WSDualHttpBinding only in WPF application. Before changes this WCF worked. Now not working. I changed only ServiceBehaviour (ConcurrencyMode and InstanceContextMode) to:
[ServiceBehavior(IncludeExceptionDetailInFaults = true, ConcurrencyMode = ConcurrencyMode.Reentrant, InstanceContextMode = InstanceContextMode.PerSession)]
After that, WCF not responding, see exception detail. Any ideas?
System.Reflection.TargetInvocationException was unhandled by user code
HResult=-2146232828
Message=An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
Source=System
StackTrace:
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at MainModuleTracking.GXService.GetServerItemsCompletedEventArgs.get_Result() in d:\Projects\!New!\GXClient\MainModuleTracking.Desktop\Service References\GXService\Reference.cs:line 6274
at Main.ViewModels.LogOnWindowViewModel.BaseFW_OnGetServerItemsCompleted(Object sender, GetServerItemsCompletedEventArgs e) in d:\Projects\!New!\GXClient\Main.Silverlight\ViewModels\LogOnWindowViewModel.cs:line 208
at MainModuleTracking.GXService.MainServiceClient.OnGetServerItemsCompleted(Object state) in d:\Projects\!New!\GXClient\MainModuleTracking.Desktop\Service References\GXService\Reference.cs:line 8818
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.ShowDialog()
InnerException: System.TimeoutException
HResult=-2146233083
Message=Opening the http://192.168.7.104:8181/WpfMainService channel timed out after 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.
Source=mscorlib
StackTrace:
Server stack trace:
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at MainModuleTracking.GXService.IMainService.EndGetServerItems(IAsyncResult result)
at MainModuleTracking.GXService.MainServiceClient.EndGetServerItems(IAsyncResult result) in d:\Projects\!New!\GXClient\MainModuleTracking.Desktop\Service References\GXService\Reference.cs:line 8802
at MainModuleTracking.GXService.MainServiceClient.OnEndGetServerItems(IAsyncResult result) in d:\Projects\!New!\GXClient\MainModuleTracking.Desktop\Service References\GXService\Reference.cs:line 8810
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
InnerException:
EDIT
callbackService = new ServiceCallback();
InstanceContext context = new InstanceContext(callbackService);
mainService = new MainServiceClient(context, "WSDualHttpBinding_IMainService");
mainService.SubscribeErrorsAsync();
mainService.GetServerItemsAsync();
Looks like your WCF call is timing out because you have set your WCF server (to essentially) Single access. If you have multiple calls to the service at the same time, your WCF service processes them one at a time, and with your very short timeout, its not surprising that some of them timeout.
Could you explain WHY you changed your ConcurrencyMode?
I don't know how, but problem was resolved after time. I think problem was in missing updates.
Now, I tried to used in VS2013 and after build working all perfectly (and without VS2013).

Cannot create instance of 'MainWindow' defined in assembly

I'm not sure if this has been posted before, but I can't find an answer.
I started a new job and when I start up this wpf project I get this error as the inner exception:
{"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."}
There are several suggestion on adding an exception for visual studio 2008, but I'm running 2010. Does anyone know what next steps I should take to resolve the issue?
at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
at System.Windows.Markup.TreeBuilder.Parse()
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Digitalembrace.RPMS.RPMSImport.App.Main() in C:\Dev\RPMS_Solution\RPMSImport\obj\x86\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Exploring the inner stack trace led me to a connection / trust issue regarding one of the services. Place a breakpoint at the top of the MainWindow and step through. Errors like this often confuse me the most. Don't give up, just step through and ask for help.

Small Problem with WPF XBAP

Sometimes my XBAP application gives this error. Did someone else had this problem?
System.InvalidOperationException: No further operations are possible with this instance.
This is on https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=496484
Complete stack
System.InvalidOperationException: No further operations are possible with this instance.
at System.Deployment.Application.InPlaceHostingManager.AssertState(State validState)
at System.Deployment.Application.InPlaceHostingManager.Execute()
at MS.Internal.AppModel.XappLauncherApp.ExecuteDownloadedApplication()
at System.Windows.Interop.DocObjHost.RunApplication(ApplicationRunner runner)
at MS.Internal.AppModel.XappLauncherApp.XappLauncherApp_Exit(Object sender, ExitEventArgs e)
at System.Windows.Application.OnExit(ExitEventArgs e)
at System.Windows.Application.DoShutdown()
at System.Windows.Application.ShutdownImpl()
at System.Windows.Application.ShutdownCallback(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
This error stopped happening they release the final stable .Net Framework 4.0 .
This was problably caused by some bug in the Beta that I was using.

Resources