Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Invalid attempt to call MetaData when reader is closed. #163

Closed
webtimisten opened this issue Aug 22, 2017 · 21 comments
Closed

Invalid attempt to call MetaData when reader is closed. #163

webtimisten opened this issue Aug 22, 2017 · 21 comments

Comments

@webtimisten
Copy link

I've just upgraded an old 7.3.4 to 7.6.5, and now I'm getting the error:
Invalid attempt to call MetaData when reader is closed.

If I set "Force redirect" to true it works.

This is the case on both old/existing redirects and new created after upgrade.

I've tried uninstall and installed the package again without any luck.


Exception Details:
System.InvalidOperationException: Invalid attempt to call MetaData when reader is closed.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[InvalidOperationException: Invalid attempt to call MetaData when reader is closed.] System.Data.SqlClient.SqlDataReader.get_MetaData() +1685663 System.Data.SqlClient.SqlDataReader.CheckMetaDataIsReady() +20 System.Data.SqlClient.SqlDataReader.GetOrdinal(String name) +57 umbraco.DataLayer.RecordsReaderAdapter1.GetOrdinal(String fieldName) +23 umbraco.DataLayer.RecordsReaderAdapter1.GetBoolean(String fieldName) +26 InfoCaster.Umbraco.UrlTracker.Modules.UrlTrackerModule.LoadUrlTrackerMatchesFromDatabase(HttpRequest request, String urlWithoutQueryString, Boolean urlHasQueryString, String shortestUrl, Int32 rootNodeId, String& redirectUrl, Nullable`1& redirectHttpCode, Boolean& redirectPassThroughQueryString) in D:\kipusoep\Documents\GitHub\UrlTracker\Modules\UrlTrackerModule.cs:447 InfoCaster.Umbraco.UrlTracker.Modules.UrlTrackerModule.UrlTrackerDo(String callingEventName, Boolean ignoreHttpStatusCode) in D:\kipusoep\Documents\GitHub\UrlTracker\Modules\UrlTrackerModule.cs:206 InfoCaster.Umbraco.UrlTracker.Modules.UrlTrackerModule.context_EndRequest(Object sender, EventArgs e) in D:\kipusoep\Documents\GitHub\UrlTracker\Modules\UrlTrackerModule.cs:59 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

@daniel-chenery
Copy link
Collaborator

@webtimisten I've been seeing the same issue. If you refresh does the error go away?
I think it's related to #146

@guruprasad83
Copy link

Hi,

Even we are facing the same issue "Exception message: Invalid attempt to call MetaData when reader is closed."

We just upgraded from 7.4.3 to 7.6.5 and started getting this error.
It was working fine till we upgraded Umbraco.

@daniel-chenery - Tried refreshing the page and error still exists.

Current Umbraco Version - 7.6.5
.Net Targetframework version - 4.5

Any help would be much appreciated.

Below is the stacktrace:

at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlDataReader.CheckMetaDataIsReady()
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at umbraco.DataLayer.RecordsReaderAdapter1.GetOrdinal(String fieldName) at umbraco.DataLayer.RecordsReaderAdapter1.GetBoolean(String fieldName)
at InfoCaster.Umbraco.UrlTracker.Modules.UrlTrackerModule.LoadUrlTrackerMatchesFromDatabase(HttpRequest request, String urlWithoutQueryString, Boolean urlHasQueryString, String shortestUrl, Int32 rootNodeId, String& redirectUrl, Nullable`1& redirectHttpCode, Boolean& redirectPassThroughQueryString) in D:\kipusoep\Documents\GitHub\UrlTracker\Modules\UrlTrackerModule.cs:line 447
at InfoCaster.Umbraco.UrlTracker.Modules.UrlTrackerModule.UrlTrackerDo(String callingEventName, Boolean ignoreHttpStatusCode) in D:\kipusoep\Documents\GitHub\UrlTracker\Modules\UrlTrackerModule.cs:line 206
at InfoCaster.Umbraco.UrlTracker.Modules.UrlTrackerModule.context_EndRequest(Object sender, EventArgs e) in D:\kipusoep\Documents\GitHub\UrlTracker\Modules\UrlTrackerModule.cs:line 60
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

@daniel-chenery
Copy link
Collaborator

@guruprasad83 How odd, every time I've seen this it's usually after an App Pool recycle, and goes away after a page refresh (once the records are cached).
I've done a PR (#164) which should have a fix for this. Do feel free to try it and let me know if the error goes away...

@guruprasad83
Copy link

Thank @daniel-chenery for the quick response.
We don't have the sourcecode as we had used the URLTracker package itself.
I had seen you requested for merging to the main branch. When will this change be updated in the package any idea ?

@daniel-chenery
Copy link
Collaborator

@guruprasad83 Probably not (#157).

I had the package installed via NuGet. I uninstalled it, and dropped the DLL from my custom build into the bin folder. Nothing broke, all the redirects remained :)
You could probably get away with just replacing the DLL, but that might go a bit funny should you use another machine...
Obviously do backup your database beforehand as a precaution

@kipusoep
Copy link
Owner

kipusoep commented Sep 4, 2017

Hi guys,

I'm sorry this package isn't maintained anymore at the moment, but I could add you (@daniel-chenery) as contributor?

@webtimisten
Copy link
Author

Why isn't it maintained? There aren't other packages, that does job as your package.

The "Redirect Url Management" in Umbraco doesn't support creating custom redirects - and is therefore useless imo, when you're relaunch a new website with a new site structure, .

@daniel-chenery
Copy link
Collaborator

@kipusoep Yes, please do go ahead :)
We use this plugin extensively in our Umbraco sites, hence the Pull Request. We had a few break with the newer versions of Umbraco.

Would you mind dropping me an email so I can query some things with you?

@kipusoep
Copy link
Owner

kipusoep commented Sep 4, 2017

Because like mentioned in #135 "I'm unable to maintain the Url Tracker project."
Besides the way Umbraco introduced the Redirect Url Management feature felt like a kick in the nuts.

@webtimisten
Copy link
Author

We understand the way you feel, but as I said, their integration is useless. Have you been in dialog with the Umbraco Team? Maybe you can come up with a solution, where your code is pulled into the Redirect Url Management?
You should of course get huge credits for it in some way, so everybody knows how awesome your package was.

@kipusoep
Copy link
Owner

kipusoep commented Sep 4, 2017

I don't think the code is good enough to migrate into a new solution ;-)
For me it's also a time issue; to maintain this package I would have to do it all in my spare time and I don't want to spend my spare time on this anymore.

@daniel-chenery
Copy link
Collaborator

@kipusoep I manage to understand the code! It's certainly good :)
I do wish Umbraco would bring this into core, or at least something very similar.

Like @webtimisten, there is no plugin out there as a real alternative to this. They're all missing features in some way.

Thanks for the access, I'll merge my changes in soon...
Are you wanting me to release a new version on NuGet also so others can have the fix? 😱

@kipusoep
Copy link
Owner

kipusoep commented Sep 4, 2017

Thanks for the access, I'll merge my changes in soon...

No problem!

Are you wanting me to release a new version on NuGet also so others can have the fix? 😱

Yes ofcourse, that would be great. What's your username on nuget?
And if you need access to anything else, let me know!

@daniel-chenery
Copy link
Collaborator

@kipusoep Literally just created an account 😂 "daniel-chenery"
https://www.nuget.org/profiles/daniel-chenery

Do you have any official release tests?
Obviously I've tested my changes on the sites I've had with the issues, just want to make sure I'm not missing any tests...

@kipusoep
Copy link
Owner

kipusoep commented Sep 4, 2017

image

;-)

@daniel-chenery
Copy link
Collaborator

@kipusoep Then I would agree 😂

@guruprasad83
Copy link

@daniel-chenery - Saw you merged the changes to the code. many thanks.
Since we were using the package, how can we get your changes?

@webtimisten
Copy link
Author

I would like the updated package too :-)

@daniel-chenery
Copy link
Collaborator

@guruprasad83 @webtimisten If all goes well, it will be on NuGet shortly today :)

@daniel-chenery
Copy link
Collaborator

This should now all be on NuGet for you all :)
Hopefully it fixes your issues!

@kipusoep Does anything need doing with the Our Umbraco listing?

@kipusoep
Copy link
Owner

kipusoep commented Sep 5, 2017

Nice job daniel. The Our Umbraco listing is out-of-date anyway and I think NuGet is the way to go nowadays, so I suggest leaving it like it is.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants