I have 4 environments:
Win 7 64 bit
Win 2003 32 bit
Win XP SP3 32 bit
Win 2003 64 bit
In the first 2, my app loads and runs successfully. In the latter 2, I get the following error (shortened):
System.Windows.Markup.XamlParseException: The method or operation is not implemented.
---> System.NotImplementedException: The method or operation is not implemented.
at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
...
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
--- End of inner exception stack trace ---
...
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at DBSophic.Qure.WorkloadAnalyzer.UI.App.InitializeComponent()
in e:\Qure\Dev\BuildSystem\Sources\Trunk\DBSophic.Qure.WorkloadAnalyzer.UI\App.xaml:line 1
at DBSophic.Qure.WorkloadAnalyzer.UI.AppMain.Main()
in e:\Qure\Dev\BuildSystem\Sources\Trunk\DBSophic.Qure.WorkloadAnalyzer.UI\AppMain.cs:line 21
What might cause it?
The missing DLL will be one referenced by a namespace in your XAML.
Try loading your application in Dependency Walker to see if all dependent modules exist on each computer. As a guess I'd question if DBSophic is installed with the correct version (or at all), and of course that the latest .NET 4 framework is installed.
It was a missing dll.
Related
I want to write a custom view using new version of razor page in 2sxc module. My view "_MyView.cshtml" inherits Custom.Dnn.Razor12. So I've created a file "_MyView.code.cshtml" which starts with #inherits Custom.Dnn.Code12 (tried #inherits ToSic.Sxc.Dnn.RazorComponent as well but didn't help).
So when I'm trying to call something like this within "_MyView.cshtml":
#{
Code.MyMethod();
}
it gives me error:
Error: System.Web.HttpCompileException (0x80004005): d:\Projects\mywebsite.com.ua\Host\Portals\2\2sxc\MyApp_MyView.cshtml(5): error CS0103: The name 'Code' does not exist in the current context at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) at ToSic.Sxc.Engines.RazorEngine.CreateWebPageInstance() in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\RazorEngine.cs:line 146 at ToSic.Sxc.Engines.RazorEngine.InitWebpage() in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\RazorEngine.cs:line 155 at ToSic.Sxc.Engines.RazorEngine.Init() in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\RazorEngine.cs:line 80 at ToSic.Sxc.Engines.EngineBase.Init(IBlock block) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Engines\EngineBase.cs:line 77 at ToSic.Sxc.Blocks.BlockBuilder.GetEngine() in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Blocks\BlockBuilder_Render.cs:line 227 at ToSic.Sxc.Dnn.Web.DnnClientResources.NeedsPre1025Behavior() in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Core\Dnn\Web\DnnClientResources.cs:line 95 at ToSic.Sxc.Dnn.View.<>c__DisplayClass13_0.<Page_Load>b__1() in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn\View.ascx.cs:line 82 at ToSic.Sxc.Dnn.View.TryCatchAndLogToDnn(Action action, LogCall timerWrap) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn\View.ascx.Errors.cs:line 22 - CONTEXT: Page: 126; Module: 1724
I understand that if I keep using old classes it might work now but it might stop working later. So how do I use this one?
I tried to look through 2sxc documentation and github code, but I didn't find a single example of it.
So what am I doing wrong? How do I use it?
The Code.xxx convention was introduced around v11 because it looked like a good idea. It kind of felt like a separation of code and layout.
https://docs.2sxc.org/net-code/razor/code-behind.html
Basically it was a kind of simplification, but not major, since you could already just do something like var code = CreateInstance("razorfile.cshtml"); to get the same effect.
But as we went to v12 and supported Oqtane - which was .net Core 3.0 at that time, we realized that this will never work on Oqtane. To us it's really important to keep the API consistent across platforms because otherwise the docs get really confusing.
Since it was such a minor feature, we decided to not support it any more on newer base classes.
So if you do have shared code, just use a something.cs file and use CreateInstance("something.cs").
For a simulated code-behind which utilizez Razor features you can still create a _xyz.code.cshtml and also instantiate it with CreateInstance(...) but this would never work in Oqtane.
I have an DNN site where i get this error alot (and i mean alot) and i cant find the source to the problem!
Is there anyone who has an idea of where to start looking or how to debug this?
I cant find the fault its impossible.. :(
DNN PLATFORM
v. 09.01.01 (129)
4.6 .NET FRAMEWORK
General Exception
Site name
AbsoluteURL /Default.aspx DefaultDataProvider DotNetNuke.Data.SqlDataProvider
AbsoluteURL:/Default.aspx
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:d1a7b7bf-b7fa-4b86-ab6d-a3efabebf994
AssemblyVersion:
PortalId:-1
UserId:-1
TabId:-1
RawUrl:
Referrer:
UserAgent:
ExceptionHash:jn6m7y6lLHEjghJrIXICAWzADhA=
Message:Value cannot be null. Parameter name: type
StackTrace:
at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at DotNetNuke.UI.Skins.Pane.IsVesionableModule(ModuleInfo moduleInfo) at DotNetNuke.UI.Skins.Pane.InjectModule(ModuleInfo module) at DotNetNuke.UI.Skins.Skin.InjectModule(Pane pane, ModuleInfo module)
InnerMessage:
InnerStackTrace:
Source:mscorlib
FileName:
FileLineNumber:0
FileColumnNumber:0
Method:
Server Name:SERVERNAME
The root cause of this issue is because "PortalAliasId" column in "TabUrls" table consists of value "1", by default this should be NULL instead.
https://dnnsupport.dnnsoftware.com/hc/en-us/articles/360021667014-Accessing-the-page-settings-fails-to-retrieve-content
I've got a problem with a Silverlight application. It has been working and I haven't changed the code, but I have changed a few other things such as upgrading to VS2012. I thought all was well with the project post upgrade but have now run in to trouble.
When the application starts it throws an exception during the InitializeComponent call. It looks like the problem is with the ResourceDictionary, specifically I notice this in the inner exception:
InnerException: System.Collections.Generic.KeyNotFoundException
Which makes me think it's trying to set a property and can't find the key it's looking for in the ResourceDictionary. I've been tearing my hair out trying to discover how to determine what key it's looking for, can anyone suggest a debugging technique to do this?
The full details of the exception are:
System.Windows.Markup.XamlParseException occurred Message=Set
property 'System.Windows.FrameworkElement.Style' threw an exception.
[Line: 228 Position: 64] LineNumber=228 LinePosition=64
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at MyApp.Silverlight.MainPage.InitializeComponent()
at MyApp.Silverlight.MainPage..ctor() InnerException: System.Windows.Markup.XamlParseException
Message=Failed to assign to property 'System.Windows.ResourceDictionary.Source'. [Line: 5 Position: 36]
LineNumber=5
LinePosition=36
StackTrace:
at MS.Internal.XcpImports.CreateFromXaml(UnmanagedMemoryStream stream,
String sourceAssemblyName, Boolean createNamescope, Boolean
requireDefaultNamespace, Boolean allowEventHandlers, String
xamlResourceUriString, Boolean isBinaryContent)
at System.Windows.Controls.Control.GetBuiltInStyle(IntPtr nativeTarget, IntPtr& nativeStyle)
InnerException: System.Collections.Generic.KeyNotFoundException
Message=The given key was not present in the dictionary.
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at System.Windows.ResourceManagerWrapper.GetResourceForUri(Uri xamlUri,
Type componentType)
InnerException:
Thanks very much for reading and if you have any suggestions I'll be very grateful.
I am experiencing a problem at application startup from time to time on production machines. It doesn't happen every time the application starts, and apparently it only happens on reboot. The application is started from login, added to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
Apparently, the problem is more frequent when resetting the machine, than during a reboot. Starting the application manually after it crashes is successful.
The following exception is thrown during startup:
Initialization of 'System.Windows.Controls.TextBlock' threw an exception.
System.Windows.Markup.XamlParseException: Initialization of 'System.Windows.Controls.TextBlock' threw an exception. ---> System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.Style.Seal()
at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe,FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)
at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.Controls.TextBlock.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
at System.Windows.FrameworkElement.UpdateStyleProperty()
at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
at System.Windows.FrameworkElement.TryFireInitialized()
at System.Windows.FrameworkElement.EndInit()
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Exception.Occurs.At.Different.Origins.Between.Startup()
As seen from the StackTrace, there is something going on while updating style cache. I haven't been able to reproduce this on my own computer. There are no threads involved here while starting the application, but there are a few AppDomains. The origin of the exception is not always the same, but it is exactly the same from Application.LoadComponent(Object component, Uri resourceLocator)
Because our application needs to find the configuration file from a different location than the executable (..\ProgramData....) depending on the OS, we use a separate AppDomain where we instruct it where to look for the configuration file, as we could not find any better solution of telling ConfigurationManager where to look for the file. It could of course, be related to this, though not necessarily. EDIT: ConfigurationManager.OpenMappedExeConfiguration Doesn't seem to work, as it won't refresh any user or application settings accessed through Properties.Settings.Default, etc.
Does anyone have any suggestions or recommendations on how to deal with this? Sorry I am not able to provide you with a sample to reproduce with.
That exception was because you are modifying a visual element from a thread that is not the visual one. I know this because in the first line of your exception it said:
Initialization of 'System.Windows.Controls.TextBlock' threw an exception. System.Windows.Markup.XamlParseException: Initialization of 'System.Windows.Controls.TextBlock' threw an exception. ---> System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
All the rest of the exception doesn't matter. I think it is when you are loading the initial configuration, then you use other thread. The random behavior could be that some time you find the configuration before the TextBlock control is loaded, so this times the exception will no be thrown.
To solve this please take a look to this question, and the last answer that I give (the one that use the SynchronizationContext, that really works with WPF application that use several threads). If is not clear comment and I will write the solution here.
Hope this answer helps to find that random error, its are the worsts...
I'm not sure what is causing this exception but I there is a workaround to your problem.
Instead of creating a separate AppDomain just for loading a different configuration file, you could use ConfigurationManager.OpenMappedExeConfiguration which allows you to load any .config file from anywhere in your local file system.
You use it like this:
//Map the new configuration file.
var configFileMap = new ExeConfigurationFileMap() { ExeConfigFilename = #"c:\myOther.config"};
//Get the mapped configuration file
System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
Use config.GetSection() to get specific sections for read-only use or directly the config object to change the configuration at run-time.
And you will not need the different AppDomain which will mean faster startup time :)
Getting rid of the extra AppDomain used to specify configuration file, and replacing it with the method specified in this link took care of the problem.
We're developing an EPiServer-based website and trying to deploy our latest build onto a WinXP IIS6 box.
When browsing to site, we're getting the following stack trace
[ClassFactoryException: ClassFactory not initialized]
EPiServer.BaseLibrary.ClassFactory.get_Instance() +123
EPiServer.BaseLibrary.Context.get_Repository() +14
EPiServer.WorkflowFoundation.StorageProviders.ObjectStoreStorageProvider.VerifyCommonSchemas() +15
EPiServer.WorkflowFoundation.AspNetWorkflowManager.get_StorageProvider() +44
EPiServer.WorkflowFoundation.AspNetWorkflowManager.Initialize(Boolean lazyLoading) +589
EPiServer.WorkflowFoundation.AspNetWorkflowManager.get_InstanceHandler() +16
EPiServer.WorkflowFoundation.Workflows.ApprovalService..ctor() +93
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +261
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
EPiServer.WorkflowFoundation.WorkflowSystem.RegisterServices(IWorkflowManager manager, WorkflowSettingsElement configuration) +338
EPiServer.WorkflowFoundation.WorkflowSystem.Init(HttpApplication context) +240
System.Web.HttpApplication.InitModules() +267
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1251
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +243
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +106
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +214
I've googled it, and visited the EPiServer forums, but I've not found any concrete suggestions or solutions. Has anyone else out there run into this?
Ross
The configuration file is written for IIS7 but you build in webserver in Studio want a IIS6 sonfig file.
I have wrote abut this in ny EPiServer notes
http://epiwiki.se/troubleshooting/classfactory-not-initialized
I am going out on a limb and guessing here, but did you by chance do development on EPiServer 5 SP 2 and deploy on EPiServer 5 SP 3?
In EPiServer 5 SP3 there was some remodelling in how a EPiServer handles the initialization of the application. These changes made it so that it's not possible to hook into the datafactory events in Application_Start. Instead you need to first hook into Application_FirstBeginRequest and then we have a instance of the DataFactory to work with.
Suggested reading
Definitely sounds like a configuration error. As Mattias said, the default web.config is for IIS7. This can cause problems when running IIS6 or Cassini.