Can't resolve entity, yet it exists - c#

I'm parsing an XML file that contains entities. I receive the following exception:
Reference to undeclared entity 'deg'. Line 283, position 53.
This is my DOCTYPE:
<!DOCTYPE dmodule [
<!ENTITY % ISOEntities PUBLIC "ISO 8879-1986//ENTITIES ISO Character Entities 20030531//EN//XML" "ent/ISOEntities">
%ISOEntities;
]>
Inside the ISOEntities file I have this line:
<!ENTITY deg "°"> <!-- DEGREE SIGN -->
The entity definition exists. I don't understand why this particular entity is causing an error, when everything else is being resolved.

Related

PowerShell Types.ps1xml Can't Find Type When Importing Module

I'm having trouble importing a module that contains a manifest, binary (root module), and a type file that defines a type converter or code property that references a type identified in the binary.
When I try to import the module, I can see from verbose output that the types files are loaded before the binary module's classes are imported:
VERBOSE: Loading module from path '...\bin\Debug\Module\manifest.psd1'.
VERBOSE: Loading 'TypesToProcess' from path '...\bin\Debug\Module\Type.PS1XML'.
Before the root module is loaded, I get the following error:
Import-Module : The following error occurred while loading the extended type data file: , ...\bin\Debug\Module\Type.PS1XML(64) :
Error: Unable to find type [MyRootModule.MyItemConverter].
At line:1 char:128
+ ... odule\Manifest.psd1 | Import-Module -verbose ; $Debu ...
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
The question is, how can I load types after the root module is imported (without turning the entire module into a script that loads everything by calling Import-Module and Update-TypeData for every item in the module directory)? Or what other way would I have to get around this error and import the module and types at the same time?
Here's a quick example. This module (concocted on-the-spot as an example only) has the following items:
module\manifest.psd1
module\root.dll
module\type.ps1xml
This is the content of root.dll
namespace MyRootModule {
public class MyTestItem {
public string Name {get; set;}
public int Id {get; set;}
}
public class MyItemConverter : PSTypeConverter {
// code omitted for brevity
// effectively creates a 'MyTestItem' with id '1' for string input 'one', and vice versa.
}
}
This is the relevant content of manifest.psd1
#{
RootModule = 'root.dll'
TypesToProcess = 'type.ps1xml'
}
This is the content of type.ps1xml
<?xml version="1.0" encoding="utf-8" ?>
<Types>
<Type>
<Name>MyRootModule.MyTestItem</Name>
<TypeConverter>
<TypeName>MyRootModule.MyItemConverter</TypeName>
<TypeConverter>
</Type>
</Types>
If I load the binary module first, and then force-load the manifest or use update-typedata -PrependPath $pathToTypeFile, everything works and I can use the converter as I'd expect to be able to (i.e. [MyRootModule.MyTestItem]1 returns a new instance of [MyRootModule.MyTestItem]), which indicates that the problem has nothing to do with the converter itself.
TLDR; The powershell module is loading the types file before the binary, and since a type defined in the binary is not found at that time the import fails.
Took me some time but I'll mark the answer here in case anyone else runs into this problem. There's a member of the module manifest that I had forgotten about/never paid much attention to, RequiredAssemblies. You can mark your dll as a required assembly as well as the root module to import it before types files are loaded. (Note: it still needs listed as the root or a nested module to import cmdlets.)
As an example, updating the manifest listed above to the following fixes the issue:
#{
RootModule = 'root.dll'
TypesToProcess = 'type.ps1xml'
RequiredAssemblies = 'root.dll'
}

unable to generate BIML for script component

I am trying to create a simple flow using the BIML <ScriptComponentProject> tag, but it does not work for me!
if I create the data flow manually, then it works perfectly fine!
my data flow has: SRC > SCRIPT-COMPONENT > TGT
the only logic that I have added is to calculate a row-number for each incoming row (keeping the logic absolutely simple for now)
when the manual solution is executed:
the sequential row-number is stored in the TGT table (test_np_02)
Great!
however, when I try to create absolutely the same package using the attached BIML, I get the following errors:
SSIS Output log:
Error 0 The namespace '<global namespace>' already contains a definition for 'Input0Buffer'. ...\Designer\BufferWrapper.cs 14 14
Error 0 The namespace '<global namespace>' already contains a definition for 'UserComponent'. ...\Designer\ComponentWrapper.cs 12 14
Error 0 The namespace '<global namespace>' already contains a definition for 'Connections'. ...\Designer\ComponentWrapper.cs 49 14
Error 0 The namespace '<global namespace>' already contains a definition for 'Variables'. ...\Designer\ComponentWrapper.cs 60 14
EmitSsis. Internal Compiler Error: Workflow EmitSsis contains fatal errors. Phase execution halted.
I am unsure what is going wrong when I try to create the PKG using BIML:
these errors never popped up when I created the package manually (with the same code)
I copy-pasted the important C# files from the manual solution into the BIML
Questions / Ideas:
is it something to do with the GUID that has to be used for ProjectCoreName, AssemblyProduct and AssemblyTitle?
is this automatically generated each time the BIML is expanded?
if so, how can I create a GUID in the BIML itself for these items .. so that it works directly after expansion?
is it something to do with the sequence in which I have to create the .cs files in the BIML, within the <Files> tag?
I currently assume that actual sequence of the <File> items within the <Files> tag is not relevant for BIML
could it be that I have to generate "Resources.resx/Resources.Designer.cs" and "Settings.settings/Settings.Designer.cs" as well in the BIML?
is it really important to have the "#region Namespaces" section in each .cs file?
I removed that from the manual soln .. that still worked fine !
Pls help.
Notes:
I am using SSDT 2015 and Varigence BIMLExpress 2017 (Build 5.0.61915.0)
I am aware that this could very easily be done using ROW_NUMBER() within SQLServer in the SRC itself, but:
I am using OleDbSource in the attached example just to keep it simple
finally, I will have to generate hundreds of code PKGs with BIML, which will have the SRC as a flat file, and not OleDB.
and obviously, I would love to have my generated ScriptComponents work immediately after expansion .. without any further manual interventions :)
Thanx,
NP
BIML file: https://drive.google.com/file/d/10O3aSL5IO34ULS44wl7IX4LUmPH_pI6V/view?usp=sharing
The error will disappear if you wrap your classes in a custom namespace.
namespace SomeNamespace {
public class UserComponent: ScriptComponent
{
...
}
public class Connections
{
...
}
public class Variables
{
...
}
}
namespace SomeNamespace {
public class Input0Buffer: ScriptBuffer
{
...
}
}
Also one remark about (dynamically) creating multiple packages from this Biml file: You will have to assign a dynamic namespace name like so:
namespace <#=variableContainingNamespaceName#> {
...
}
About your remarks:
The issue is not related to the ProjectCoreName, but I fear that you may run into issues if you reuse the same ProjectCoreName for multiple packages generated from the same biml (without having actually tested it)
No
Not necessary
No, the section is not necessarily required.

How to set MONO_PATH on OSX System.Data.SqlClient.SqlException (remote SQLServer db)

Scenario:
I run xsp4 --port 9000 from the command line in the directory of my .net app.
I navigate to localhost:9000 and see this:
Back on the console I see this:
Path '/Default.aspx' built successfully, but a compilation exception has been thrown for other files:
Compiler errors:
(0,0) : warning CS1685: The predefined type `System.Runtime.CompilerServices.AsyncStateMachineAttribute' is defined multiple times. Using definition from `mscorlib.dll'
(0,0) : error : /Library/Frameworks/Mono.framework/Versions/4.0.3/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous warning)
(0,0) : error : /Users/liveclass/Documents/changeyourenergy/Bin/System.Runtime.dll (Location of the symbol related to previous warning)
(0,0) : warning CS1685: The predefined type `System.Runtime.CompilerServices.CallerMemberNameAttribute' is defined multiple times. Using definition from `mscorlib.dll'
(0,0) : error : /Library/Frameworks/Mono.framework/Versions/4.0.3/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous warning)
(0,0) : error : /Users/liveclass/Documents/changeyourenergy/Bin/System.Runtime.dll (Location of the symbol related to previous warning)
(0,0) : warning CS1685: The predefined type `System.Runtime.CompilerServices.CallerLineNumberAttribute' is defined multiple times. Using definition from `mscorlib.dll'
(0,0) : error : /Library/Frameworks/Mono.framework/Versions/4.0.3/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous warning)
(0,0) : error : /Users/liveclass/Documents/changeyourenergy/Bin/System.Runtime.dll (Location of the symbol related to previous warning)
(0,0) : warning CS1685: The predefined type `System.Runtime.CompilerServices.CallerFilePathAttribute' is defined multiple times. Using definition from `mscorlib.dll'
(0,0) : error : /Library/Frameworks/Mono.framework/Versions/4.0.3/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous warning)
(0,0) : error : /Users/liveclass/Documents/changeyourenergy/Bin/System.Runtime.dll (Location of the symbol related to previous warning)
Exception thrown:
System.Web.Compilation.CompilationException: : /Library/Frameworks/Mono.framework/Versions/4.0.3/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous warning)
...
I tried:
Seeing if there is a MONO_PATH issue in case mono is using .net4.5 as opposed to 4.0 like I want. I noticed this issue here, but am unable to figure out how to set the MONO_PATH correctly on a Mac (as I haven't used one since 1986). The instructions seem to apply to ubuntu.
I noticed that there is a mono --config FILE option, however, I can't seem to find anything in the latest docs that tells me how to create a config file and actually use the option.
Running export MONO_MANAGED_WATCHER=disabled based on this article. This fixed a different issue.

Cannot modify deposit using interop.qbfc12

In a c# program using interop.qbfc12, the following code:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError = "continueOnError">
<DepositModRq requestID = "0">
<DepositMod>
<TxnID>B2864-1388784731</TxnID>
<EditSequence>1388784731</EditSequence>
<TxnDate>2014-01-03</TxnDate>
<DepositToAccountRef>
<FullName>Checking Acct-CCFCSB</FullName>
</DepositToAccountRef>
<Memo>Test deposit memo for 01032014-1</Memo>
<DepositLineMod>
<TxnLineID>B2866-1388784731</TxnLineID>
</DepositLineMod>
<DepositLineMod>
<TxnLineID>B2867-1388784731</TxnLineID>
</DepositLineMod>
</DepositMod>
</DepositModRq>
</QBXMLMsgsRq>
</QBXML>
produces this error:
DepositMod
DepositLineModList:
element(1) - ORDepositLineMod: required field is missing
End of DepositLineModList
End of DepositMod
When I use the same code in a vba project using qbfc12 type library, I get no error.
Does the interop library differ from the qbfc library? What must I do to resolve this error.
You might need to look at the XML being generated by the QBFC12 library to see what the difference is.
You are giving DepositLineMod's, but what are you modifying?

Cassette.AssetReferenceException being fired when removing a file from folder

I used to have a .js file in /Public/javascripts/jquery1.1js.
Everything was working perfectly but then I needed to delete this file from my project, so I just removed it from the solution in Visual Studio.
Now when I visit my application, I get:
Reference error in "~/Public/javascripts/jquery.unobtrusive-ajax.js",
line 1. Cannot find "~/Public/javascripts/jquery-1.5.1.js". Reference
error in "~/Public/javascripts/jquery.validate.unobtrusive.js", line
1. Cannot find "~/Public/javascripts/jquery-1.5.1.js".
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: Cassette.AssetReferenceException: Reference error
in "~/Public/javascripts/jquery.unobtrusive-ajax.js", line 1. Cannot
find "~/Public/javascripts/jquery-1.5.1.js". Reference error in
"~/Public/javascripts/jquery.validate.unobtrusive.js", line 1. Cannot
find "~/Public/javascripts/jquery-1.5.1.js".
Here's a stacktrace:
[AssetReferenceException: Reference error in "~/Public/javascripts/jquery.unobtrusive-ajax.js", line 1. Cannot find "~/Public/javascripts/jquery-1.5.1.js".
Reference error in "~/Public/javascripts/jquery.validate.unobtrusive.js", line 1. Cannot find "~/Public/javascripts/jquery-1.5.1.js".]
Cassette.BundleContainer.ValidateAssetReferences() +387
Cassette.BundleContainer..ctor(IEnumerable`1 bundles) +41
Granted, I know why this is happening, Cassette is still trying to find the deleted file, but I'm not sure how to tell Cassette: "Hey, this file is no longer relevant. Scan the folder again and rebuild a list of files you need to work with."
But I just don't know how to accomplish this.
The documentation has no mention of this and just implies that it should do this automatically for me.
Here's my Configuration class:
using Cassette.Configuration;
using Cassette.Scripts;
using Cassette.Stylesheets;
namespace XXX.WebUI
{
/// <summary>
/// Configures the Cassette asset modules for the web application.
/// </summary>
public class CassetteConfiguration : ICassetteConfiguration
{
public void Configure(BundleCollection bundles, CassetteSettings settings)
{
bundles.AddPerIndividualFile<ScriptBundle>("Public/javascripts/");
bundles.AddPerIndividualFile<StylesheetBundle>("Public/stylesheets/");
}
}
}
And in my _Layout.cshtml file:
#{
Bundles.Reference("Public/javascripts/site.js");
Bundles.Reference("Public/javascripts/jquery.validate.unobtrusive.js");
Bundles.Reference("Public/stylesheets/site.less");
}
<!DOCTYPE html>
...
<head>
<title>#ViewBag.Title</title>
#Bundles.RenderStylesheets()
...
#Bundles.RenderScripts()
</body>
Does the jquery.validate.unobtrusive.js file contain a JavaScript reference at the top to jquery-1.5.1.js?
The line would look like:
/// <reference path="jquery-1.5.1.js" />
If so, remove that line. Cassette uses those references to determine build order.
ref: http://getcassette.net/documentation/scripts
This can also happen if you reference files with the same root
e.g. easyXDM.js and easyXDM.debug.js
When you reference easyXMD.js it gives the exception and the solution seems to be use a different naming convention that ensures the roots are different such as easyXMDdebug.js.

Categories