Trouble creating the DNN Survey Module from source code - vb.net

My boss has asked me to set up DotNetNuke's Survey Module and make a few custom changes to it for a client. But I'm having trouble just getting the bare-bones code to run properly!
Here's what I've done so far:
Downloaded both the source & install folders from
http://dnnsurvey.codeplex.com/releases/view/65186
Created a new VB Web Application Project
Took out all the default pages
Copied the Survey source code into the VB Web Application Project in exactly the same structure
Made a batch script that creates an installation folder identical to DNN's install folder (double-checked by running a folder-diff on it, and all files/folders were identical)
Zipped up my installation folder using 7-zip
The source code compiles perfectly. But even though the files/folders are identical, DNN's zipped package will work properly on my DNN site, and my own zipped package will fail with this famous error message:
Error: Survey is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Could not load type 'DotNetNuke.Modules.Survey.survey'. ---> System.Web.HttpParseException: Could not load type 'DotNetNuke.Modules.Survey.survey'. ---> System.Web.HttpParseException: Could not load type 'DotNetNuke.Modules.Survey.survey'. ---> System.Web.HttpException: Could not load type 'DotNetNuke.Modules.Survey.survey'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() 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) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc) at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace ---
I've already asked about this on the DNN forums, but they don't have much to say about it :( So, I thought I'd try StackOverflow as well.
Does anybody have any idea what the problem could be? Thanks very much in advance!

If you want to create package, correctly, you have to first install the module that you have in your dnn instance. Once you are done with that, you did the right job till step4. After step 4 I generally do following:
Go to project properties, and point the bin directory path to parent dnn installation's bin directory
Add reference of dotentnuke.dll and microsoft data acecss application blogs dll
Rebuild the project
Once you can correctly compile the app, you are ready to customize it.
Always use dnn's module create wizard to create package. it is easier and error free way of packaging and delivering the modules.
let me know if you need any other help

I ended up solving this one on my own. These are the steps I took:
Removed all Namespace DotNetNuke.Modules.Survey declaractions
Deleted the ascx, ascx.vb, and designer files for survey, Settings,
and EditSurvey
Created new, empty ones with those names (but used "Survey" instead
of "survey")
Copied/pasted the ascx code into each ascx file (and changed
DotNetNuke.Modules.survey to DotNetNuke.Modules.Survey)
Did a build
Copied/pasted the ascx.vb code into each ascx.vb file (and removed
the Namespace declarations in these files)
Did a build, which was 100% successful this time
Bizarre way to solve the problem, but it worked. :3

Related

I'm trying to set up a new SharePoint production server and getting an error creating an Open XML 2.5 document

I have a SharePoint application written in Visual Basic that works fine and creates Word Documents using Open XML 2.5 on my development machine. We recently set up a new Production server and I published the .wsp file and deployed it on the new server. The application all works fine except the code that generates reports in Word format. It fails on the following line of code.
Dim wpd As WordprocessingDocument = WordprocessingDocument.Create(MemStream, WordprocessingDocumentType.Document, True)
This is what the code looks like in the function that is failing.
''' \<summary\>
'''
''' \</summary\>
''' \<param name="MemStream"\>\</param\>
''' \<returns\>\</returns\>
Public Function WPDCreateFromStream(MemStream As MemoryStream) As WordprocessingDocument
Try
Dim wpd As WordprocessingDocument = WordprocessingDocument.Create(MemStream, WordprocessingDocumentType.Document, True)
Dim MainPart As MainDocumentPart = wpd.AddMainDocumentPart()
MainPart.Document = New Document()
Dim DocBody As New Body()
Return wpd
Catch ex As Exception
WriteErrorToEventLog("OpenXML", "WPDCreateFromStream", "", ex)
Return Nothing
End Try
End Function
Here is the exception detail I get when trying to make the WordProcessingDocument.Create call above.
ERROR: Source: OpenXML Routine: WPDCreateFromStream User:
Message: The type initializer for 'MS.Utility.EventTrace' threw an exception.
StackTrace: at MS.Utility.EventTrace.EasyTraceEvent(Keyword keywords, Event eventID)
at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.CreateCore(Stream stream)
at DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Create(Stream stream, WordprocessingDocumentType type, Boolean autoSave)
at FIS.SP.PSTARProjectTracker.PSTAR.Core.BusinessLogic.OpenXML.WPDCreateFromStream(MemoryStream MemStream)
Source: WindowsBase
Data: System.Collections.ListDictionaryInternal
InnerException: System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
at MS.Utility.EventTrace.IsClassicETWRegistryEnabled()
at MS.Utility.EventTrace..cctor()
The Zone of the assembly that failed was:
MyComputer
ToString: System.TypeInitializationException: The type initializer for 'MS.Utility.EventTrace' threw an exception. ---> System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
at MS.Utility.EventTrace.IsClassicETWRegistryEnabled()
at MS.Utility.EventTrace..cctor()
--- End of inner exception stack trace ---
at MS.Utility.EventTrace.EasyTraceEvent(Keyword keywords, Event eventID)
at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.CreateCore(Stream stream)
at DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Create(Stream stream, WordprocessingDocumentType type, Boolean autoSave)
at FIS.SP.PSTARProjectTracker.PSTAR.Core.BusinessLogic.OpenXML.WPDCreateFromStream(MemoryStream MemStream)
TargetSite: Void EasyTraceEvent(Keyword, Event)
I know this is not an issue with the code as the same code works in development. I assume it has to do with permissions, or getting the DocumentFormat.OpenXML.dll installed / registered correctly on the new server, but I've had no luck searching for a solution.
I tried installing OpenXML and the Productivity tool on the server. The productivity tool works and can open a word document, but the Application has the same issue.
If anyone has run into this and can point me to a solution, I would appreciate it.
The MemoryStream is created and passed in to be used by this function. The WordProcessingDocument is returned to the calling function. I could explicitly call ByVal, but in this case it would not change anything.
I am creating a new document, that is why it is coded using WordProcessingDocument.Create
Remember, this code all functions perfectly on the development SharePoint server. It has been used heavily for about a year. I'm just trying to get this to work on a new production server we recently stood up. I have to believe this is related to some permission issue, or a component that is not installed or registered correctly. For Open XML, I believe there is just the one DLL (DocumentFormat.OpenXML.DLL) and it does not register. It is on the server from installing the .wsp package. I also tried installing Open XML 2.5 on the server along with the productivity tool and they all work fine.
The more I think about it, it just feels like a permission issue.

Ravendb database export/import issue in versioning

We are using RavenDB 2.0 and bundle 2330.
We have a problem in export/import of versioned documents. We did the following.
We had a database with versioning bundle enabled
We had a number of records with multiple versions
exported the database to a dump file using Raven-Studio
Tried importing the same in another server with versioning bundle
But the server refused to import the documents and gave error as follows and stopped Import
Server sent:
at Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task
parent, Func2 func) at
Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task parent,
Action1 action) at
Raven.Studio.Commands.ImportDatabaseCommand.<>c_DisplayClass8.b_1()
at System.Threading.Tasks.Task.InnerInvoke() at
System.Threading.Tasks.Task.Execute() at
System.Threading.Tasks.Task.ExecutionContextCallback(Object obj) at
System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx) at
System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&
currentTaskSlot) at
System.Threading.Tasks.Task.ExecuteEntry(Boolean
bPreventDoubleExecution) at
System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch() at
System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Client side exception: System.Net.WebException:
[HttpWebRequest_WebException_RemoteServer] Arguments: NotFound
Debugging resource strings are unavailable. Often the key and
arguments provide sufficient information to diagnose the problem. See
http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.20513.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer
at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult
asyncResult) at System.Func2.Invoke(T arg) at
System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult
iar, Func2 endFunction, Action1 endAction, Task`1 promise)
So we removed the versioning bundle and then imported and then applied the versioning bundle.
The import was successful. But all the versions of the documents are being treated as separate documents and not as different version
We are on our alpha stage and suddenly recovering such issues in RavenDB. Any ideas please?
Muthu,
Do Following Steps :
Go to your database where you find list of tables.
click check all to select all the tables.
select export option from dropdown.That will export your tables.
Now create new database where you want all that record
Go inside that database (select database name.)
Go to Import tab.
Now create zip of that exported file. If your server allow simple upload then you can do that also.
Upload that zip/sql exported
your tables are ready to use.
Tell me its working for you or not?

Index was outside the bounds of the array in #Scripts.Render

For each controller have a folder (with the same name controler), and for each action a script file.
For each file is creating a bundle following the pattern: "~/Scripts/Controllers/{controller-name}/{filename-without-extension}"
bundles.IncludePerFile(new DirectoryInfo(server.MapPath("~/Scripts/Controllers")), "~/Scripts/Controllers/{0}/{1}",
(dir,file) => string.Format("~/Scripts/Controllers/{0}/{1}", dir, Path.GetFileNameWithoutExtension(file)), "*.js");
IncludePerFile is an extension method I created to perform this task
Then one bundle for: ~/Scripts/Controllers/processos/pasta should exist!
And to confirm this:
So far so correct! The bundle exists!
Running app
When I run the application, the following error occurs:
Full image
Wrongly and inefficient to repair the error:
If I change this:
#Scripts.Render("~/Scripts/Controllers/processos/pasta")
to this:
#Scripts.Render("~/Scripts/Controllers/processos/pasta.js")
No error is generated. But the file is not minified since there is effectively a bundle. (I have already put in release mode and published application!)
Full error
Index was outside the bounds of the array.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Source Error:
Line 3: #section js {
Line 4: #*#Scripts.Render("~/Scripts/Controllers/processos/Pasta.js", "~/Scripts/Controllers/processos/display.js")*#
Line 5: #Scripts.Render("~/Scripts/Controllers/processos/pasta")
Line 6: #Scripts.Render("~/Scripts/Controllers/processos/display.js")
Line 7:
Source File: w:\Clients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB\CreditoImobiliarioBB.Web\Views\processos\display.cshtml Line: 5
Stack Trace:
[IndexOutOfRangeException: Index was outside the bounds of the array.]
System.String.get_Chars(Int32 index) +0
Microsoft.Ajax.Utilities.CssParser.Append(Object obj, TokenType tokenType) +402
Microsoft.Ajax.Utilities.CssParser.AppendCurrent() +74
Microsoft.Ajax.Utilities.CssParser.SkipToClose() +744
Microsoft.Ajax.Utilities.CssParser.SkipToEndOfStatement() +232
Microsoft.Ajax.Utilities.CssParser.ParseRule() +574
Microsoft.Ajax.Utilities.CssParser.ParseStylesheet() +1235
Microsoft.Ajax.Utilities.CssParser.Parse(String source) +897
Microsoft.Ajax.Utilities.Minifier.MinifyStyleSheet(String source, CssSettings settings) +419
System.Web.Optimization.CssMinify.Process(BundleContext context, BundleResponse response) +302
System.Web.Optimization.Bundle.ApplyTransforms(BundleContext context, String bundleContent, IEnumerable`1 bundleFiles) +207
System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) +355
System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context) +104
System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath) +254
System.Web.Optimization.AssetManager.EliminateDuplicatesAndResolveUrls(IEnumerable`1 refs) +435
System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable`1 assets) +1029
System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat, String[] paths) +75
System.Web.Optimization.Scripts.RenderFormat(String tagFormat, String[] paths) +292
System.Web.Optimization.Scripts.Render(String[] paths) +51
I've had the same error in this question: StyleBundle Index was outside the bounds of the array
And answer is pretty simple: you have to update your Microsoft Web Optimization & WebGrease packages (at this time 1.1.2 & 1.6.0 versions)
I would verify that all the elements of your
IncludePerFile(new DirectoryInfo(server.MapPath("~/Scripts/Controllers")), "~/Scripts/Controllers/{0}/{1}",
(dir,file) => string.Format("~/Scripts/Controllers/{0}/{1}", dir, Path.GetFileNameWithoutExtension(file)), "*.js")
are putting in the created bundles exactly what you think they're putting in.
I got this error at run time when the wrong type of file is included within a bundle. i.e.
#Styles.Render("~/bundles/myStyleBundle");
actually contains a JavaScript file.
I had the same problem and when I tried different checking I found out that there is a selector in my css file like this that cause the problem:
.glyphicons-icon _:-o-prefocus,
.glyphicons-icon {
background-image: url(../images/glyphicons.png);
}
it seems that Microsoft.Ajax.Utilities.CssParser has a problem with _: css selector. I removed the line and it's working.
I just ran into a similar problem. I am using VS 2013 and MVC 5 and was updating to Bootstrap v3.0.1 in order to use a theme from Bootswatch. I updated everything using the latest Bootstrap download and the site seemed to work fine. I then grabbed the CSS for Slate from the Bootswatch site and used it in the new stylesheet, changed it in the StyleBundle and built solution. When I ran it, I got the "Index was outside the bounds of the array" error. Switch back to bootstrap.css and it worked fine.
I then used NuGet Package Manager to update all my packages... I had just installed VS 2013 and not yet updated everything. Rebuilt the solution and wallah, it works great. So I would up vote the updating your packages answser.
You may need to update some of your nuget libraries. Try updating WebGrease
I'm using
#Scripts.Render()
For me it was an issue with the backtik in JS file.
Sample 1
let something = `some text
bla bla
`;
Above code thrown this exception
Index and length must refer to a location within the string.
Sample 2
let something = `some text
bla bla`;
Now it works well, so do not keep the closing backtik at the beginning new line ...

Could not find any resources appropriate for the specified culture (or the neutral culture) exception when using CreateFileBasedResourceManager

In my win forms application, I have a Language Folder in which I have compiled the .resources file from a text file. But When I run the application I get the below exception
Could not find any resources appropriate for the specified culture (or the neutral culture) on disk. baseName: SpanishLanguageResource.es-ES locationInfo:
My Code is:
Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo(gLocale)
rm = ResourceManager.CreateFileBasedResourceManager("SpanishLanguageResource.es-ES", ".", Nothing)
Can anyone Please guide me into the right direction What I am missing? Thanks
I added the .resource file to the bin directory and it resolved the issue.

NHibernate - Cannot set the ConfigurationCache property after calling Init

In my S#arp Arch 2.0 project, I'm communicating with 2 databases. This runs fine locally with the ASP.Net Development Server (VS 2010) and passes unit tests requiring talking to either database.
Next step was to Publish the project (using VS' built-in "Publish" menu option) to the in-house development server (Windows Server 2008 R2) and fire this thing up on a real server where people could actually see it.
Now I get the exception shown in the title when I try to run the application. The exception is thrown at the = new NHibernateConfigurationFileCache() line below:
private void InitialiseNHibernateSessions()
{
NHibernateSession.ConfigurationCache = new NHibernateConfigurationFileCache();
NHibernateSession.InitStorage(this.webSessionStorage);
NHibernateSession.AddConfiguration(NHibernateSession.DefaultFactoryKey,
new[] { Server.MapPath("~/bin/SRN2.Infrastructure.dll") },
new AutoPersistenceModelGenerator().Generate(),
Server.MapPath("~/NHibernate.config"),
null, null, null);
NHibernateSession.AddConfiguration(SRN2.Infrastructure.DataGlobals.OTHER_DB_FACTORY_KEY,
new string[] { Server.MapPath("~/bin/SRN2.Infrastructure.dll") },
new AutoPersistenceModelGenerator().Generate(),
Server.MapPath("~/NHibernate-OTHER.config"),
null, null, null);
}
Stack trace:
[InvalidOperationException: Cannot set the ConfigurationCache property after calling Init]
SharpArch.NHibernate.NHibernateSession.set_ConfigurationCache(INHibernateConfigurationCache value) +105
SRN2.Web.Mvc.MvcApplication.InitialiseNHibernateSessions() in C:\code\SRN2-Sharp2\trunk\Solutions\SRN2.Web.Mvc\Global.asax.cs:122
SharpArch.NHibernate.NHibernateInitializer.InitializeNHibernateOnce(Action initMethod) +116
SRN2.Web.Mvc.MvcApplication.Application_BeginRequest(Object sender, EventArgs e) in C:\code\SRN2-Sharp2\trunk\Solutions\SRN2.Web.Mvc\Global.asax.cs:71
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Jon is right, it does sound like your InitialiseNHibernateSessions method is being called multiple times. You don't have to use the config cache, have you tried disabling it?
The NHibernate configuration is cached to file in order to improve start up time. If the configuration has not changed it is loaded from the cache file. The default location of the cache file is the system temporary file folder (e.g. Path.GetTempPath()).
If you don't have file permissions, or don't need config caching, just remove or comment out the line that initialises the configuration cache, i.e. this line:
NHibernateSession.ConfigurationCache = new NHibernateConfigurationFileCache();
This error occurred, for one application, roughly every month or two months for an extended period. I haven't really been able to fix this permanently but I did discover that the following procedure resolves the error for:
Delete the temporary configuration cache files; they should be located in the Windows temporary files folder and there should be a file for each database (e.g. DatabaseName--1973822310.bin) and another named something like nhibernate.current_session--1973822310.bin.
Restart the IIS web site for your application.
Recycle the application pool for your application.