Null Reference exception DNN Core 5.6.3 - vb.net

My site has been running fine for sometime now until recently I see in the event viewer a null reference exception in the DNN core:
DotNetNuke.Common.Globals.GetStatus() in
F:\Builds\Maintenance\WorkingDirectory\Library\Common\Globals.vb:line
1125 at DotNetNuke.Common.Initialize.InitializeApp(HttpApplication
app) in
F:\Builds\Maintenance\WorkingDirectory\Library\Common\Initialize.vb:line
138 at DotNetNuke.Common.Initialize.Init(HttpApplication app) in
F:\Builds\Maintenance\WorkingDirectory\Library\Common\Initialize.vb:line
228 at DotNetNuke.Common.Global.Global_BeginRequest(Object sender,
EventArgs e) at
System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)
the line 1125 is:
_Status = UpgradeStatus.None
Which is a property of the Globals class and an Enum
Also when this happens it doesnt just do it once then sort its self it does it roughly every minute for an hour or so.
I made sure all dataprovider.instances are either in a using or a try catch finally or self closing(if the reader is not used)
Any suggestion most welcome, as I'm officially lost.
Thanks

Similar to what ScottS mentioned, that line is setting a static enum value, so I don't see how a NullReferenceException could be thrown. Indeed, it could be a side-effect from something else.
That particular error is coming from Global.asax BeginRequest, which calls Initialize.Init(app). The only thing I can think of is to check your Http Modules. Both the RequestfilterModule and the UrlRewriteModule (which are default DNN http modules) also call Initialize.Init(app).
Perhaps check your web.config and IIS (particularly if you're running IIS 7) and make sure everything checks out?

had a look at the release.config and it have autoupdate=true set that to false and it hasnt been an issue since.

Related

ExceptionFilterAttribute may not be logging exceptions in ApplicationInsights

Do exceptions that are filtered with a custom ExceptionFilterAttribute logged to Application Insights?
I want to return a custom DTO in my custom ExceptionFilterAttribute filter, but I think exceptions are no longer logged into ApplicationInsights after that. This is for .NET Core 3.0.
I added a line with:
this.telemetryClient.TrackException(context.Exception);
to make sure I can see the exception but I'm not sure if my exceptions are logged twice now.
Does anyone know if ApplicationInsights will log exception if they enter ExceptionFilterAttribute? I can't find documentation for this.
I'm calling just in case also:
base.OnException(context);
Does anyone know if ApplicationInsights will log exception if they
enter ExceptionFilterAttribute?
Yes, it will log the exceptions, so you do not need to add this line of code this.telemetryClient.TrackException(context.Exception);. Just using base.OnException(context); is ok.
You can see this GitHub issue for the similar issue, the reason is that "With new Ilogger enablement by default, exceptions are automatically reported by application insights.".
I also check it via a simple test, the test result as below:

Unhandle exception issue

We have a large app built using VB.NET VS2012. Every now and then when closing the app an unhandled exception occurs. Very random, sometimes it does it sometimes it doesn't.
The error is below.
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)
at System.Windows.Forms.WindowsFormsSynchronizationContext.Post(SendOrPostCallback d, Object state)
at System.Windows.Forms.AxHost.ConnectionPointCookie.Finalize()
InnerException:
We produce a dump file to try and find where this is originating but have had no luck. The debugger just shows No source code available. We are using some third-party controls. At this point we just want to find what is trying to create the control. If its a problem with the third party control and if we don't have that code, we can't fix it but maybe we can work around it. But we can't find what is trying to create control (when shutting down).
We have reviewed many web posts describing how to utilize the crash dump files but have had no luck identifying the control (or even the control type) that is generating this.. Just knowing the type would help narrow it down.
Any ideas how we can at least get the type of control or the originating caller or?
If enough info isn't provided please let me know and I will post what I can.
Posting code is not an option because we have no idea where the message is coming from.
Thanks in advance!
I should have added that we do use try catch blocks for just about everything. We also do have a logging procedure but we arent seeing any of these exceptions in the log file.

Exception in xaml while opening the Silverlight 4 project

Today i encounter a strange thing. Yesterday all my code was working fine i test it twice before shutting down my pc. Today when i try to open my project exception arrives
"System.NullReferenceException
Object reference not set to an instance of an object."
I searched for the solutions, but none works for me. I did not upgrade silverlight version, i start my work with silverlight 4 and cuurently i am using the same.
Here is the stack trace for the exception:
System.NullReferenceException
Object reference not set to an instance of an object.
at Microsoft.Windows.Design.Platform.SilverlightMetadataContext.SilverlightXamlExtensionImplementations.d__8.MoveNext()
at MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption()
at MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier identifier)
at MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope parentScope, IParseContext context)
at MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent, PrefixScope parentScope, IParseContext context, IMarkupSourceProvider provider)
at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean convertToXamlWithErrors)
at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem()
at Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem()
at Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState()
at MS.Internal.Host.PersistenceSubsystem.Load()
at MS.Internal.Host.Designer.Load()
at MS.Internal.Designer.VSDesigner.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.Load()
Hopefully your suggestions will solve my problem.
After trying for 3-4 hours i go for simple aproach and it works!
Here is what i do:
Go to Add/Remove Program and uninstall all silverlight application, all of them.
Rebbot my pc, install SL4 tools, SL4 Toolkit and SL4 Developer runtime.
Make sure that you change the option for SL4 to update its version automatically.
Another reboot and it's done
I suspect that as i did not change the default setting so SL4 updated itself to SL5 without notifying me :)
Make sure to disable automatic updates.

<nativehr>0x80070002</nativehr> in Sharepoint 2010

I recently upgraded from Sharepoint 2007 to 2010. I have a windows service that inserts pdfs into sharepoint. It works great on 2007. When I migrated to 2010, I started getting the following intermittent error:
<nativehr>0x80070002</nativehr>
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder) at
Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder) at Microsoft.SharePoint.SPWeb.GetList(String strUrl)
Here is the offending line of code:
SPList parentList = web.GetList(url);
What's weird, is that this only occasionally fails. I've actually wrapped this line of a loop, and if it it fails, I wait a bit, and then try to get the list again. Usually after a few tries, the GetList will succeed.
Since it's not easly duplicatable, I'm looking for any leads I might be able to track down.
From google searches, the "recommend" fix is to change any .GetList(...) calls to SPWeb.Lists[".."];
But, I got away from that, due to the perf hit on 2007 ( .GetList(...) has better perf than SPWeb.Lists["..."])
Any suggestions?
Thanks!
Dave
Maybe you could understand the error better if you first retrieved an SPFolder or SPFile related to the url in question. Check .GetFile(...).Exists and .GetFolder(...).Exists. You could also get the ParentList property hence.
SPWeb.GetList Method will certainly raise error if list is not there in the site. The method is designed like that. It is already documented in msdn.
If you are unsure that list is there or not; use Webobject.List[ListName] to avoid exception.
You can check my blog SharePoint Codes for sample code
I think this is late reply, but hope it helps others in future.
What resolved exact same error on SPWeb.GetList(reletiveUrl) with error thrown in method GetMetadataForUrl on SharePoint 2010:
restart IIS
restart SPTimerV4 (SharePoint 2010 Timer)
restart SPAdminV4 (SharePoint 2010 Administration)

FileInfo..ctor(string fileName) throwing exception: bug in SL 4.0 or .NET 4.0?

The following test case passes in .NET 4.0:
var fiT = new FileInfo("myhappyfilename");
Assert.IsNotNull(fiT);
... but fails in Silverlight 4.0 with the following error:
System.ArgumentNullException: Value cannot be null.
Parameter name: format
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at System.Environment.GetResourceString(String key, Object[] values)
at System.IO.FileSecurityState.EnsureState()
at System.IO.FileInfo.Init(String fileName, Boolean checkHost)
at System.IO.FileInfo..ctor(String fileName)
Either the failure is a bug in SL 4.0, or the non-failure is a bug in .NET 4.0. Anyone know which it is?
(For the record, I'm running SL 4.0 on VS 2010 RC, which may be contributing to the problem).
See the MSDN documentation for FileInfo for Siverlight 4:
When it is called by an elevated-trust
application, provides instance methods
for the creation, copying, deletion,
moving, and opening of files, and aids
in the creation of FileStream objects.
This class cannot be inherited.
Chances are your application isn't running with elevated trust. If you want to access those restricted methods, it'll need to be.
As to why it's returning a null - that may well be a bug, possibly an improperly propagated SecurityException. Then again, it may be as designed - the docs are also still pre-release. EDIT: gabe's answer is most likely correct on this point.
Since you generally can't access the filesystem from Silverlight (you need a fully-trusted OOB app), it looks like SL4 is trying to throw an exception, but is failing because the text for that exception isn't available in the SL4 beta. Presumably you would get the correct exception once SL4 is released.