I've tried a couple of times to get .Net running on my MacBook using instructions found on the official Asp.Net docs and elsewhere. The latest attempt was using the Yeoman generator instructions found here.
However when I try to run DNU Restore, I am always presented with the same error, albeit for a different library. The error is "unknown header: " followed by a number that differs depending on the library. Here is one example (only the first few and last few lines included for brevity):
Error: DownloadPackageAsync: https://www.nuget.org/api/v2/package/Microsoft.AspNet.Loader.IIS/1.0.0-beta5
Unknown header: 3649249205
----------
System.NotSupportedException: Unknown header: 3649249205
at SharpCompress.Common.Zip.ZipHeaderFactory.ReadHeader (UInt32 headerBytes, System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0
at SharpCompress.Common.Zip.SeekableZipHeaderFactory+<ReadSeekableHeader>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at SharpCompress.Archive.Zip.ZipArchive+<LoadEntries>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at SharpCompress.LazyReadOnlyCollection`1+LazyLoader[SharpCompress.Archive.Zip.ZipArchiveEntry].MoveNext () [0x00000] in <filename unknown>:0
at System.IO.Compression.ZipArchive.CreateZip (System.IO.Stream stream, ZipArchiveMode mode) [0x00000] in <filename unknown>:0
at System.IO.Compression.ZipArchive..ctor (System.IO.Stream stream, ZipArchiveMode mode, Boolean leaveOpen) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Restore.NuGet.PackageUtilities.EnsureValidPackageContents (System.IO.Stream stream, Microsoft.Framework.PackageManager.PackageInfo package) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Restore.NuGet.PackageUtilities+<>c__DisplayClass1_0.<OpenNupkgStreamAsync>b__0 (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Restore.NuGet.HttpSource+<GetAsync>d__8.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Restore.NuGet.PackageUtilities+<OpenNupkgStreamAsync>d__1.MoveNext () [0x00000] in <filename unknown>:0
...
Restore failed
Unknown header: 3649249205
NuGet Config files used:
/Users/jamie.morris/.config/NuGet/NuGet.Config
Feeds used:
https://www.myget.org/F/aspnetvnext/api/v2/
https://nuget.org/api/v2/
I've tried deleting the contents of ~/.dnx/packages and removing old versions of dnx from ~/.dnx/runtimes. At present I am using the 1.0.0-beta6-12170 runtime.
Has anyone else had a similar problem or figured out how to fix it?
EDIT:
Here is the output of dnvm list:
Active Version Runtime Arch Location Alias
------ ------- ------- ---- -------- -----
* 1.0.0-beta6-12170 mono ~/.dnx/runtimes default
Here is the output of mono --version:
Mono JIT compiler version 3.12.1 (tarball Tue Mar 17 15:03:14 GMT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
Upgrade to Mono 4.0.1 or greater.
Related
I've gone through the example event-tracing projects located at https://github.com/microsoft/eventtracing-processing-samples and successfully built the projects. I'm running into missing dll's. For instance when running the CountProcesses example, I run into the following stack trace:
mono CountProcesses.exe test.etl
Unhandled Exception:
System.DllNotFoundException: msi.dll assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) Microsoft.Windows.EventTracing.NativeMethods.MsiGetSummaryInformationW(uint,string,uint,uint&)
at Microsoft.Windows.EventTracing.ToolkitTraceProcessingEngine.GetRevisionNumber (System.String msiPath) [0x00000] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Microsoft.Windows.EventTracing.ToolkitTraceProcessingEngine.GetOrCreateDefaultToolkitPath (System.IO.TextWriter output) [0x00054] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Microsoft.Windows.EventTracing.ToolkitTraceProcessingEngine.Create (System.String path, Microsoft.Windows.EventTracing.ITraceProcessorSettings settings, Microsoft.Windows.EventTracing.ITraceProcessorSettings& effectiveSettings) [0x000a8] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Microsoft.Windows.EventTracing.TraceProcessor.Create (System.String path, Microsoft.Windows.EventTracing.ITraceProcessorSettings settings) [0x00000] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Microsoft.Windows.EventTracing.TraceProcessor.Create (System.String path) [0x00000] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Program.Run (System.String tracePath) [0x00001] in <2e2989aba7be4139841be131a5e978bb>:0
at Program.Main (System.String[] args) [0x00027] in <2e2989aba7be4139841be131a5e978bb>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: msi.dll assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) Microsoft.Windows.EventTracing.NativeMethods.MsiGetSummaryInformationW(uint,string,uint,uint&)
at Microsoft.Windows.EventTracing.ToolkitTraceProcessingEngine.GetRevisionNumber (System.String msiPath) [0x00000] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Microsoft.Windows.EventTracing.ToolkitTraceProcessingEngine.GetOrCreateDefaultToolkitPath (System.IO.TextWriter output) [0x00054] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Microsoft.Windows.EventTracing.ToolkitTraceProcessingEngine.Create (System.String path, Microsoft.Windows.EventTracing.ITraceProcessorSettings settings, Microsoft.Windows.EventTracing.ITraceProcessorSettings& effectiveSettings) [0x000a8] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Microsoft.Windows.EventTracing.TraceProcessor.Create (System.String path, Microsoft.Windows.EventTracing.ITraceProcessorSettings settings) [0x00000] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Microsoft.Windows.EventTracing.TraceProcessor.Create (System.String path) [0x00000] in <bdfe3783769b4c6f90b3788d264e0262>:0
at Program.Run (System.String tracePath) [0x00001] in <2e2989aba7be4139841be131a5e978bb>:0
at Program.Main (System.String[] args) [0x00027] in <2e2989aba7be4139841be131a5e978bb>:0
Before digging too deeply into the missing libraries, is traceprocessing intended to be cross-platform? Or does it rely on platform dependent libs in Windows?
System Setup:
OS: macOS Catalina 10.15.4
Mono JIT compiler version 6.8.0.105 (2019-10/82fffe07497 Tue Feb 4 10:09:51 EST 2020)
.NET Core SDK (3.1.201)
(I am a developer at Microsoft who works on the TraceProcessor project.)
Currently, the library relies on some Windows-only components and cannot be run on a Mac.
I'm trying to run an unmodified Web Api application created by yo aspnet.
I'm getting this error:
System.EntryPointNotFoundException: uv_loop_size
at (wrapper managed-to-native) Microsoft.AspNet.Server.Kestrel.Networking.Libuv+NativeDarwinMonoMethods:uv_loop_size ()
at Microsoft.AspNet.Server.Kestrel.Networking.Libuv.loop_size () <0x42615b8 + 0x00014> in <filename unknown>:0
at Microsoft.AspNet.Server.Kestrel.Networking.UvLoopHandle.Init (Microsoft.AspNet.Server.Kestrel.Networking.Libuv uv) <0x4261528 + 0x0002b> in <filename unknown>:0
at Microsoft.AspNet.Server.Kestrel.KestrelThread.ThreadStart (System.Object parameter) <0x4261160 + 0x0005f> in <filename unknown>:0
Any ideas?
dnvm list output:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-final coreclr x64 darwin
1.0.0-rc1-final mono linux/osx
* 1.0.0-rc2-16177 mono linux/osx default
mono version
Mono JIT compiler version 4.2.1 (explicit/6dd2d0d Tue Nov 10 18:01:18 EST 2015)
Update
I ran
export DYLD_FALLBACK_LIBRARY_PATH=/Users/Andy/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/
which ended up giving me a different error when running dnx web:
System.DllNotFoundException: libc.dylib
at (wrapper managed-to-native) System.IO.KeventWatcher:kqueue ()
at System.IO.KeventWatcher.GetInstance (IFileWatcher& watcher) <0x105a29310 + 0x000f3> in <filename unknown>:0
at System.IO.FileSystemWatcher.InitWatcher () <0x105a28fa0 + 0x0012c> in <filename unknown>:0
at System.IO.FileSystemWatcher..ctor (System.String path, System.String filter) <0x105a28d00 + 0x00114> in <filename unknown>:0
at System.IO.FileSystemWatcher..ctor (System.String path) <0x105a28cc0 + 0x00023> in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher:.ctor (string)
at Microsoft.AspNet.FileProviders.PhysicalFilesWatcher..ctor (System.String root) <0x105a285b0 + 0x00154> in <filename unknown>:0
at Microsoft.AspNet.FileProviders.PhysicalFileProvider..ctor (System.String root) <0x105a282d0 + 0x000e4> in <filename unknown>:0
at Microsoft.AspNet.Hosting.HostingEnvironmentExtensions.Initialize (IHostingEnvironment hostingEnvironment, System.String applicationBasePath, IConfiguration config) <0x105a27f20 + 0x001ea> in <filename unknown>:0
at Microsoft.AspNet.Hosting.WebHostBuilder.Build () <0x105a1a860 + 0x000b8> in <filename unknown>:0
at Microsoft.AspNet.Hosting.WebApplication.Run (System.Type startupType, System.String[] args) <0x105560990 + 0x00216> in <filename unknown>:0
at Microsoft.AspNet.Hosting.WebApplication.Run (System.String[] args) <0x10555fef0 + 0x0001a> in <filename unknown>:0
at Microsoft.AspNet.Hosting.Program.Main (System.String[] args) <0x10555fec0 + 0x00014> in <filename unknown>:0
at Microsoft.AspNet.Server.Kestrel.Program.Main (System.String[] args) <0x10555fc90 + 0x000b5> in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x1050027a0 + 0x000b7> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () in <filename unknown>:line 0
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) in <filename unknown>:line 0
at Microsoft.Dnx.ApplicationHost.Program+<>c__DisplayClass3_0.<ExecuteMain>b__0 () in <filename unknown>:line 0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () in <filename unknown>:line 0
at System.Threading.Tasks.Task.Execute () in <filename unknown>:line 0
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at System.IO.FileSystemWatcher.Stop () in <filename unknown>:line 0
at System.IO.FileSystemWatcher.Finalize () in <filename unknown>:line 0
FYI: This is not mono related
It is not finding the libuv native library via the System.Net.Libuv assembly:
https://github.com/dotnet/corefxlab/blob/d76ebe8ab5ed058d3d6903939ab0e4ee4e19b773/src/System.Net.Libuv/src/System/Net/Libuv/Interop.cs
1st) Run dnvm list -detailed to determine the location of dnx runtimes that you are using, i.e.
Active Version Runtime Architecture OperatingSystem Alias Location
------ ------- ------- ------------ --------------- ----- --------
1.0.0-beta8 mono linux/osx ~/.dnx/runtimes
1.0.0-rc1-final mono linux/osx ~/.dnx/runtimes
* 1.0.0-rc2-16177 mono linux/osx default ~/.dnx/runtimes
2nd) My dnx installs are $HOME/.dnx/runtime (the default), so I can run find ~/.dnx/packages -name "libuv*"
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win10-arm/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win7-x64/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win7-x86/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win10-arm/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win7-x64/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win7-x86/native/libuv.dll
Once you find where your libuv.dylib does live on your system, you can set the env. var DYLD_FALLBACK_LIBRARY_PATH to that directory:
export DYLD_FALLBACK_LIBRARY_PATH=/your/libuv/directory/location:$DYLD_FALLBACK_LIBRARY_PATH
Run your dmvm cmd again:
dnvm exec 1.0.0-rc2-16177 dnx web
Note:
On OS-X libuv is also available via brew # stable version 1.7.5 but I have not tried it as MS is not versioning their libuv.dylib build so I am not sure if it is a custom version or not ...(?)
otool -L /Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib:
/Users/asplab/Documents/buildAgent/temp/buildTmp/fs-poll-5b0daf.out (compatibility version 0.0.0, current version 0.0.0)
After many reinstalls of Mono, Visual Code, Xamarin Studio, DNX, libuv, an upgrade of Node and RoberN giving me some clear pointers, I figured I should check my PATH env variable.
Sure enough, as soon as I added /usr/lib/:/usr/local/lib to my PATH, it all started working!
dnx web
Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Success!
In case anyone comes here looking for another solution...
I tried all of the above, including multiple re-installs of everything and PATH updates without success, and finally switched to CoreCLR as per the solution here and it finally worked!
dnvm install 1.0.0-rc1-update1 -r coreclr -arch x64
dnvm use 1.0.0-rc1-update1 -r coreclr -arch x64
dnvm list
then, go to your project and try it again
dnx web
I'm trying out all kind of new features of asp.net 5 and documenting it and now I hit the first obstacle. I can't get my code to run in a docker container, I'm not even trying to get the container to listen to changes, I just want it to run.
I've based my image on microsoft/aspnet and added code to install node, npm, bower and grunt so I can build the application in the container. I know I probably can build it in the client before I add it to the container, but I want to give this a try. The image builds fine, but when I start the container it can't find Kestrel.
System.IO.FileNotFoundException: Could not load file or assembly 'Kestrel' or one of its dependencies. The system cannot find the file specified.
File name: 'Kestrel'
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.Server.ServerLoader.LoadServerFactory (System.String serverFactoryIdentifier) [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.HostingEngine.EnsureServerFactory (Microsoft.AspNet.Hosting.HostingContext context) [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.HostingEngine.Start (Microsoft.AspNet.Hosting.HostingContext context) [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Shouldn't Kestrel already exist since I base it on microsoft/aspnet?
The code to my Dockerfile: https://github.com/mastoj/OneManBlog/blob/master/src/OneManBlog/Dockerfile
The microsoft/aspnet base image (https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta4/Dockerfile) only gives you the minimum distro needed to run Kestrel, including dnvm and the latest dnx, but NOT Kestrel itself. Add the Kestrel NuGet package to the dependencies in your project.json and build the docker image again:
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.Hosting": "1.0.0-beta4",
"Kestrel": "1.0.0-beta4"
}
EDIT: Did a test on your repo and that made it work :)
I need help figuring out what's wrong in my mono setup. I get NullReferenceExceptions when I try to run webforms and mvc3 apps on apache/mod_mono.
Here's the exceptions I get to httpd error log when trying to load pages on a browser:
Accessing a web forms page:
An exception has occurred while generating HttpException page:
System.NullReferenceException: Object reference not set to an instance of an object
at System.Web.Util.HttpEncoder.GetCustomEncoderFromConfig () [0x00000] in <filename unknown>:0
at System.Lazy`1[System.Web.Util.HttpEncoder].InitValue () [0x00000] in <filename unknown>:0
The actual exception which was being reported was:
System.Web.HttpException: ---> System.NullReferenceException: Object reference not set to an instance of an object
at System.Web.HttpApplication.InitOnce (Boolean full_init) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
An exception has occurred while generating HttpException page:
System.NullReferenceException: Object reference not set to an instance of an object
at System.Web.Util.HttpEncoder.GetCustomEncoderFromConfig () [0x00000] in <filename unknown>:0
at System.Lazy`1[System.Web.Util.HttpEncoder].InitValue () [0x00000] in <filename unknown>:0
The actual exception which was being reported was:
System.Web.HttpException: Server cannot flush a completed response
at System.Web.HttpResponse.Flush (Boolean final_flush) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.OutputPage () [0x00000] in <filename unknown>:0
Accessing a mvc3 page:
An exception has occurred while generating HttpException page:
System.NullReferenceException: Object reference not set to an instance of an object
at System.Web.Util.HttpEncoder.GetCustomEncoderFromConfig () [0x00000] in <filename unknown>:0
at System.Lazy`1[System.Web.Util.HttpEncoder].InitValue () [0x00000] in <filename unknown>:0
The actual exception which was being reported was:
System.Web.HttpException: ---> System.NullReferenceException: Object reference not set to an instance of an object
at System.Web.Compilation.BuildManager.Build (System.Web.VirtualPath vp) [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.GetCompiledType (System.Web.VirtualPath virtualPath) [0x00000] in <filename unknown>:0
at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00000] in <filename unknown>:0
at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
Another symptom is similar exceptions when I run xsp4:
xsp4
Exception caught during reading the configuration file:
System.NullReferenceException: Object reference not set to an instance of an object
at Mono.WebServer.XSP.Server+ApplicationSettings..ctor () [0x00000] in <filename unknown>:0
xsp4
Listening on address: 0.0.0.0
Root directory: /usr/local/src
Listening on port: 8080 (non-secure)
Hit Return to stop the server.
Stopping the server will not cause exceptions here. I wonder if the root directory here is correct? Which configuration file is xsp trying to read?
And here's data on versions etc:
Compiled mono, mod_mono and xsp from git using prefix /usr, versions are:
mono -V
Mono JIT compiler version 3.4.1 (master/d3e5522 Fri May 9 20:16:07 MSD 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
mod-mono-server4 --version
mod-mono-server4.exe 3.0.0.0
(c) (c) 2002-2011 Novell, Inc.
Mod_mono backend for XSP
mod-mono-server4 file content:
exec /usr/bin/mono $MONO_OPTIONS "/usr/lib/mono/4.5/mod-mono-server4.exe" "$#"
xsp4 --version
xsp4.exe 3.0.0.0
Copyright (C) 2002-2011 Novell, Inc.
Minimalistic web server for testing System.Web
Can you guys spot anything that's wrong here? What could I do to fix this problem? I haven't found anything usable so far.
I did find this with same kind of exception described, but in my case xsp is not an old version.
https://www.meebey.net/posts/mono_3.0_preview_debian_ubuntu_packages/
I'm trying to use the new Mono 2.6 SqlMetal tool to create the DBML file for a simple Sqlite Database. The schema is really simple as follows:
CREATE TABLE Tags (
Id INTEGER PRIMARY KEY,
TagName TEXT,
Description TEXT);
CREATE TABLE Trends (
TagId INTEGER NOT NULL,
Timestamp DATETIME NOT NULL,
Value TEXT,
PRIMARY KEY (tagid, timestamp));
I am trying to create the DBML file using the following:
sqlmetal.exe /conn:"Data Source=MyDatabase.db" /namespace:MyNamespace /provider:Sqlite /dbml:MyDatabase.dbml
I get the following output:
>>> Reading schema from SQLite database
<<< Writing file 'MyDatabase.dbml'
sqlmetal failed:System.InvalidOperationException: There was an error reflecting type 'DbLinq.Schema.Dbml.Database'. --->
System.InvalidOperationException: DbLinq.Schema.Dbml.Database is inaccessible due to its protection level. Only public types can be processed
at System.Xml.Serialization.ReflectionHelper.CheckSerializableType (System.Type type, Boolean allowPrivateConstructors ) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Type type, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer..ctor (System.Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, System.Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0 at System.Xml.Serialization.XmlSerializer..ctor (System.Type type) [0x00000] in <filename unknown>:0
at DbLinq.Schema.Dbml.DbmlSerializer.Write (System.IO.Stream xmlStream, DbLinq.Schema.Dbml.Database dbml) [0x00000] in <filename unknown>:0
at DbMetal.Generator.Implementation.Processor.WriteSchema (DbLinq.Schema.Dbml.Database dbSchema, ISchemaLoader schemaLoader, DbMetal.Parameters parameters) [0x00000] in <filename unknown>:0
at DbMetal.Generator.Implementation.Processor.ProcessSchema (DbMetal.Parameters parameters) [0x00000] in <filename unknown>:0
I can use the /code option to create a C# code file, but it always fails when generating a DBML.
Am I missing a subtle commandline option or is this new build of SqlMetal not working for Sqlite?
<sheepish-grin>Would you believe I haven't tried to generate a DBML file before?</sheepish-grin>
Short version: this is a bug that you're hitting, with no workaround. I've filed it as http://code.google.com/p/dblinq2007/issues/detail?id=171.
Longer version: There doesn't appear to be a simple solution to this (aside from "jettison System.Xml.Serialization"), as the referenced DbLinq.Schema.Dbml.Database type can't be public from System.Data.Linq.dll, for ~obvious reasons. A "workaround" of building DbLinq under Linux and using DbMetal.exe doesn't work, due to a different bug.
Sorry for the inconvenience.